| 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 left: 200px; | |
| 30 } | |
| 31 | |
| 32 #b { | |
| 33 top: 100px; | |
| 34 left: 100px; | |
| 35 } | |
| 36 | |
| 37 #c { | |
| 38 top: 200px; | |
| 39 left: 0px; | |
| 40 } | |
| 41 | |
| 42 #d { | |
| 43 top: 300px; | |
| 44 left: 200px; | |
| 45 } | |
| 46 | |
| 47 .expectation { | |
| 48 background-color: red; | |
| 49 position: absolute; | |
| 50 width: 100px; | |
| 51 height: 100px; | |
| 52 } | |
| 53 | |
| 54 </style> | |
| 55 | |
| 56 <div class="expectation" style="top: 0px; left: 100px;"></div> | |
| 57 <div class="expectation" style="top: 100px; left: 200px;"></div> | |
| 58 <div class="expectation" style="top: 200px; left: 300px;"></div> | |
| 59 <div class="expectation" style="top: 300px; left: 400px;"></div> | |
| 60 | |
| 61 <div> | |
| 62 <div id="a" class="anim"></div> | |
| 63 <div id="b" class="anim"></div> | |
| 64 <div id="c" class="anim"></div> | |
| 65 <div id="d" class="anim"></div> | |
| 66 </div> | |
| 67 | |
| 68 <div style="height: 500px;"></div> | |
| 69 | |
| 70 <script src="../bootstrap.js"></script> | |
| 71 <script> | |
| 72 "use strict"; | |
| 73 | |
| 74 var divs = document.querySelectorAll(".anim"); | |
| 75 | |
| 76 var group = new AnimationGroup([], 2000); | |
| 77 | |
| 78 for (var i = 0; i < divs.length; i++) { | |
| 79 group.append(new Animation(divs[i], {left: (100 * (i+1)) + "px"}, {duration: 2
* 1000, fill: 'forwards'})); | |
| 80 } | |
| 81 document.timeline.play(group); | |
| 82 | |
| 83 </script> | |
| OLD | NEW |