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 <!DOCTYPE html><meta charset="UTF-8"> | |
18 <style> | |
19 .anim { | |
20 left: 0px; | |
21 width: 100px; | |
22 height: 100px; | |
23 background-color: lightsteelblue; | |
24 position: absolute; | |
25 } | |
26 | |
27 #a { | |
28 top: 0px | |
29 } | |
30 | |
31 #b { | |
32 top: 100px; | |
33 } | |
34 | |
35 #c { | |
36 top: 200px; | |
37 } | |
38 | |
39 #d { | |
40 top: 300px; | |
41 } | |
42 | |
43 #expectation { | |
44 position: absolute; | |
45 top: 0px; | |
46 left: 200px; | |
47 width: 100px; | |
48 height: 400px; | |
49 background: red; | |
50 } | |
51 </style> | |
52 | |
53 <div id="expectation"></div> | |
54 | |
55 <div id="a" class="anim a"></div> | |
56 <div id="b" class="anim b"></div> | |
57 <div id="c" class="anim a"></div> | |
58 <div id="d" class="anim b"></div> | |
59 | |
60 <div style="height: 450px"></div> | |
61 | |
62 <script src="../bootstrap.js"></script> | |
63 <script> | |
64 "use strict"; | |
65 | |
66 var effect = [{left: "100px"}, {left: "200px"}]; | |
67 | |
68 var a1 = new Animation(document.querySelector("#a"), effect, {duration: 2.6 * 10
00, fill: "forwards"}); | |
69 var a2 = new Animation(document.querySelector("#b"), effect, {duration: 2.5 * 10
00, fill: "forwards"}); | |
70 var a3 = new Animation(document.querySelector("#c"), effect, {duration: 2.5 * 10
00, fill: "forwards"}); | |
71 var a4 = new Animation(document.querySelector("#d"), effect, {duration: 2.3 * 10
00, fill: "forwards"}); | |
72 var pgroup1 = new AnimationGroup([a1, a2], {name: "p1", fill: "forwards"}); | |
73 var pgroup2 = new AnimationGroup([a3, a4], {name: "p2", fill: "forwards"}); | |
74 var player = document.timeline.play( | |
75 new AnimationSequence([pgroup1, pgroup2], {name: "s", fill: "forwards"})); | |
76 | |
77 at(1.0 * 1000, function() { player.pause(); }); | |
78 at(2.0 * 1000, function() { player.play(); }); | |
79 at(4.0 * 1000, function() { player.pause(); }); | |
80 at(5.0 * 1000, function() { player.play(); }); | |
81 | |
82 </script> | |
OLD | NEW |