3 Copyright (c) 2013 Intel Corporation.
5 Redistribution and use in source and binary forms, with or without modification,
6 are permitted provided that the following conditions are met:
8 * Redistributions of works must retain the original copyright notice, this list
9 of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the original copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its contributors
14 may be used to endorse or promote products derived from this work without
15 specific prior written permission.
17 THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
21 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 Yu, XiaoyanX <xiaoyanx.yu@intel.com>
30 Cui, Jieqiong <jieqiongx.cui@intel.com>
36 <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
37 <title>Check if window.cancelRequestAnimationFrame || window.webkitCancelRequestAnimationFrame || window.mozCancelAnimationFrame || window.msCancelAnimationFrame || window.oCancelAnimationFrame; and RequestAnimationFrame invoked sucessfully</title>
38 <script type="text/javascript" src="../resources/testharness.js"></script>
39 <link rel="stylesheet" href="../resources/testharness.css" />
42 <p>PASS If a red box will move from left to right while click the button "Start". The red box will stop while click the button "Stop"</p>
43 <p>FAIL If the screen doesn't have any animation or red box does not stop while clicks the "Stop" button</p>
46 var reqAnimAPI = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || oRequestAnimationFrame;
47 var cancelAnimAPI = window.cancelRequestAnimationFrame || window.webkitCancelRequestAnimationFrame || window.mozCancelAnimationFrame || window.msCancelAnimationFrame || window.oCancelAnimationFrame;;
49 function animate(time) {
50 document.getElementById("animated").style.left =
51 (time - animationStartTime) % 2000 / 4 + "px";
52 requestId = reqAnimAPI(animate);
55 animationStartTime = Date.now();
56 requestId =reqAnimAPI(animate);
60 cancelAnimAPI(requestId);
63 <button onclick="start()">Start</button>
64 <button onclick="stop()">Stop</button>
65 <div id="animated" style="position: absolute; left: 10px; padding: 50px;
66 background: crimson; color: white"></div>