OLD | NEW |
| (Empty) |
1 <!-- | |
2 Copyright 2012 Google Inc. All Rights Reserved. | |
3 | |
4 Licensed under the Apache License, Version 2.0 (the "License"); | |
5 you may not use this file except in compliance with the License. | |
6 You may obtain a copy of the License at | |
7 | |
8 http://www.apache.org/licenses/LICENSE-2.0 | |
9 | |
10 Unless required by applicable law or agreed to in writing, software | |
11 distributed under the License is distributed on an "AS IS" BASIS, | |
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 See the License for the specific language governing permissions and | |
14 limitations under the License. | |
15 --> | |
16 | |
17 | |
18 <!-- | |
19 This test is currently broken. | |
20 1) The test doesn't work without simulating all the frames | |
21 2) The test fails when you simulate on t=0 boundary because currentTime_ ends | |
22 up null | |
23 3) The test fails when you simulate on t=0 boundary because relativeTime | |
24 returns null when zeroTime is null | |
25 --> | |
26 | |
27 | |
28 <!DOCTYPE html><meta charset="UTF-8"> | |
29 <style> | |
30 .anim { | |
31 left: 0px; | |
32 width: 100px; | |
33 height: 100px; | |
34 background-color: #FAA; | |
35 position: absolute; | |
36 } | |
37 | |
38 #a { | |
39 top: 0px | |
40 } | |
41 </style> | |
42 | |
43 <div id="a" class="anim a"></div> | |
44 | |
45 | |
46 <script src="../bootstrap.js"></script> | |
47 <script> | |
48 "use strict"; | |
49 | |
50 var a1 = new Animation(document.querySelector("#a"), | |
51 [{left: "0px"}, {left: "500px"}], | |
52 {duration: 10 * 1000, direction: 'alternating', iterations: Infinity}); | |
53 var player1 = document.timeline.play(a1); | |
54 | |
55 var a2 = new Animation(undefined, | |
56 function(timeFraction) { | |
57 var playbackRate = 0.01 + 10 * timeFraction; | |
58 player1.playbackRate = playbackRate | |
59 player2.playbackRate = playbackRate; | |
60 document.querySelector("#a").textContent = playbackRate; | |
61 }, | |
62 a1.timing.clone()); | |
63 var player2 = document.timeline.play(a2); | |
64 | |
65 </script> | |
OLD | NEW |