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 body { margin: 0px; } | |
20 div { display: inline-block; } | |
21 #test { | |
22 width:800px; | |
23 height:50px; | |
24 background: lightsteelblue; | |
25 position:absolute; | |
26 } | |
27 </style> | |
28 <body> | |
29 <div id="test"></div> | |
30 <script src="../bootstrap.js"></script> | |
31 <script> | |
32 "use strict"; | |
33 var width = 25; | |
34 var totalWidth = 800; | |
35 var startZ = 0; | |
36 var endZ = 100; | |
37 var test = document.querySelector("#test"); | |
38 var marker = test.nextSibling; | |
39 | |
40 for (var i = 0; i < totalWidth; i += width) { | |
41 var div = document.createElement("div"); | |
42 div.style.width = width + "px"; | |
43 div.style.height = "50px"; | |
44 div.style.background = "red"; | |
45 div.style.zIndex = startZ + | |
46 Math.round((i / totalWidth) * (endZ - startZ)); | |
47 div.style.position = "relative"; | |
48 document.body.insertBefore(div, marker); | |
49 } | |
50 document.timeline.play(new Animation(document.querySelector("#test"), | |
51 [{zIndex: String(startZ)}, {zIndex: String(endZ)}], {duration: 3 * 1000, fil
l: 'forwards'})); | |
52 </script> | |
OLD | NEW |