| 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 .animContainer { | |
| 20 position: absolute; | |
| 21 left: 0px; | |
| 22 height: 100px; | |
| 23 } | |
| 24 | |
| 25 .anim { | |
| 26 left: 0px; | |
| 27 width: 100px; | |
| 28 height: 25px; | |
| 29 background-color: lightsteelblue; | |
| 30 position: relative; | |
| 31 } | |
| 32 | |
| 33 #ca { | |
| 34 top: 50px; | |
| 35 } | |
| 36 | |
| 37 #cb { | |
| 38 top: 250px; | |
| 39 } | |
| 40 | |
| 41 #cc { | |
| 42 top: 450px; | |
| 43 } | |
| 44 | |
| 45 #cd { | |
| 46 top: 650px; | |
| 47 } | |
| 48 | |
| 49 .expectation { | |
| 50 position: absolute; | |
| 51 background-color: red; | |
| 52 width: 100px; | |
| 53 } | |
| 54 </style> | |
| 55 | |
| 56 <div>All squares should line up at the end of each iteration (or start if | |
| 57 reversed).</div> | |
| 58 | |
| 59 <div class="expectation" style="top: 50px; left: 180px; height: 150px;"></div> | |
| 60 | |
| 61 <div class="expectation" style="top: 250px; left: 160px; height: 25px;"></div> | |
| 62 <div class="expectation" style="top: 275px; left: 260px; height: 50px;"></div> | |
| 63 <div class="expectation" style="top: 325px; left: 180px; height: 25px;"></div> | |
| 64 <div class="expectation" style="top: 350px; left: 140px; height: 25px;"></div> | |
| 65 <div class="expectation" style="top: 375px; left: 116px; height: 25px;"></div> | |
| 66 | |
| 67 <div class="expectation" style="top: 450px; left: 160px; height: 25px;"></div> | |
| 68 <div class="expectation" style="top: 475px; left: 260px; height: 50px;"></div> | |
| 69 <div class="expectation" style="top: 525px; left: 180px; height: 25px;"></div> | |
| 70 <div class="expectation" style="top: 550px; left: 140px; height: 25px;"></div> | |
| 71 <div class="expectation" style="top: 575px; left: 116px; height: 25px;"></div> | |
| 72 | |
| 73 <div class="expectation" style="top: 650px; left: 180px; height: 150px;"></div> | |
| 74 | |
| 75 <div class="animContainer" id="ca"> | |
| 76 <div class="anim a" id="a"></div> | |
| 77 <div class="anim b" id="b"></div> | |
| 78 <div class="anim c" id="c"></div> | |
| 79 <div class="anim d" id="d"></div> | |
| 80 <div class="anim e" id="e"></div> | |
| 81 <div class="anim f" id="f"></div> | |
| 82 </div> | |
| 83 | |
| 84 <div class="animContainer" id="cb"> | |
| 85 <div class="anim a" id="g"></div> | |
| 86 <div class="anim b" id="h"></div> | |
| 87 <div class="anim c" id="i"></div> | |
| 88 <div class="anim d" id="j"></div> | |
| 89 <div class="anim e" id="k"></div> | |
| 90 <div class="anim f" id="l"></div> | |
| 91 </div> | |
| 92 | |
| 93 <div class="animContainer" id="cc"> | |
| 94 <div class="anim a" id="m"></div> | |
| 95 <div class="anim b" id="n"></div> | |
| 96 <div class="anim c" id="o"></div> | |
| 97 <div class="anim d" id="p"></div> | |
| 98 <div class="anim e" id="q"></div> | |
| 99 <div class="anim f" id="r"></div> | |
| 100 </div> | |
| 101 | |
| 102 <div class="animContainer" id="cd"> | |
| 103 <div class="anim a" id="s"></div> | |
| 104 <div class="anim b" id="t"></div> | |
| 105 <div class="anim c" id="u"></div> | |
| 106 <div class="anim d" id="v"></div> | |
| 107 <div class="anim e" id="w"></div> | |
| 108 <div class="anim f" id="x"></div> | |
| 109 </div> | |
| 110 | |
| 111 <div style="height: 800px;"></div> | |
| 112 | |
| 113 <script src="../bootstrap.js"></script> | |
| 114 <script> | |
| 115 "use strict"; | |
| 116 | |
| 117 var containers = ["ca", "cb", "cc", "cd"]; | |
| 118 | |
| 119 var directions = ["normal", "reverse", "alternate", "alternate-reverse"]; | |
| 120 var groups = []; | |
| 121 | |
| 122 var effect100To300 = [{left: "100px"}, {left: "300px"}]; | |
| 123 var effect100To180 = [{left: "100px"}, {left: "180px"}]; | |
| 124 | |
| 125 for (var i = 0; i < directions.length; i++) { | |
| 126 var dir = directions[i]; | |
| 127 groups.push( | |
| 128 new AnimationGroup([], {iterations: 2, direction: dir, duration: 4 * 1000,
fill: 'forwards'})); | |
| 129 } | |
| 130 | |
| 131 for (var i = 0; i < containers.length; i++) { | |
| 132 var container = document.getElementById(containers[i]); | |
| 133 // Test basic use. | |
| 134 groups[i].append(new Animation(container.getElementsByClassName("a")[0], | |
| 135 effect100To300, | |
| 136 {duration: 1 * 1000, iterations: 3.1, iterationStart: 0.3, fill: 'forwards
'})); | |
| 137 groups[i].append(new Animation(container.getElementsByClassName("b")[0], | |
| 138 effect100To300, | |
| 139 {duration: 1 * 1000, iterations: 3.6, iterationStart: -0.2, fill: 'forward
s'})); | |
| 140 // Test that iterationStart is not clipped to iterations. | |
| 141 groups[i].append(new Animation(container.getElementsByClassName("c")[0], | |
| 142 effect100To300, | |
| 143 {duration: 1 * 1000, iterations: 1.6, iterationStart: 1.8, fill: 'forwards
'})); | |
| 144 // Test that nothing odd happens when iterations is an integer. | |
| 145 groups[i].append(new Animation(container.getElementsByClassName("d")[0], | |
| 146 effect100To300, | |
| 147 {duration: 1 * 1000, iterations: 3.0, iterationStart: 0.4, fill: 'forwards
'})); | |
| 148 // Test that nothing odd happens when (iterations - iterationStart) is an | |
| 149 // integer. | |
| 150 groups[i].append(new Animation(container.getElementsByClassName("e")[0], | |
| 151 effect100To300, | |
| 152 {duration: 1 * 1000, iterations: 3.2, iterationStart: 0.2, fill: 'forwards
'})); | |
| 153 // Test that nothing odd happens when (iterations + iterationStart) is an | |
| 154 // integer. | |
| 155 groups[i].append(new Animation(container.getElementsByClassName("f")[0], | |
| 156 effect100To180, | |
| 157 {duration: 1 * 1000, iterations: 2.8, iterationStart: 0.2, fill: 'forwards
'})); | |
| 158 document.timeline.play(groups[i]); | |
| 159 } | |
| 160 </script> | |
| OLD | NEW |