OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <style> | 4 <style> |
5 | 5 |
6 div { | 6 div { |
7 position: absolute; | 7 position: absolute; |
8 height: 90px; | 8 height: 90px; |
9 width: 90px; | 9 width: 90px; |
10 background: blue; | 10 background: blue; |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 <div id="div1"></div> | 35 <div id="div1"></div> |
36 <div id="div2"></div> | 36 <div id="div2"></div> |
37 | 37 |
38 <script> | 38 <script> |
39 var div1 = document.getElementById('div1'); | 39 var div1 = document.getElementById('div1'); |
40 var div2 = document.getElementById('div2'); | 40 var div2 = document.getElementById('div2'); |
41 | 41 |
42 function startAnimations() { | 42 function startAnimations() { |
43 div1.animate([ | 43 div1.animate([ |
44 {motionOffset: '0%'}, | 44 {offsetDistance: '0%'}, |
45 {motionOffset: '100%'} | 45 {offsetDistance: '100%'} |
46 ], { | 46 ], { |
47 duration: 2000, | 47 duration: 2000, |
48 delay: 1000 | 48 delay: 1000 |
49 }); | 49 }); |
50 div1.animate([ | 50 div1.animate([ |
51 {transform: 'translate(0px)'}, | 51 {transform: 'translate(0px)'}, |
52 {transform: 'translate(-800px)'} | 52 {transform: 'translate(-800px)'} |
53 ], { | 53 ], { |
54 duration: 1000, | 54 duration: 1000, |
55 delay: 2000 | 55 delay: 2000 |
56 }); | 56 }); |
57 | 57 |
58 div2.animate([ | 58 div2.animate([ |
59 {motionOffset: '0%'}, | 59 {offsetDistance: '0%'}, |
60 {motionOffset: '100%'} | 60 {offsetDistance: '100%'} |
61 ], { | 61 ], { |
62 duration: 2000, | 62 duration: 2000, |
63 delay: 1000 | 63 delay: 1000 |
64 }); | 64 }); |
65 } | 65 } |
66 | 66 |
67 requestAnimationFrame(startAnimations); | 67 requestAnimationFrame(startAnimations); |
68 | 68 |
69 </script> | 69 </script> |
70 | 70 |
71 </body> | 71 </body> |
72 </html> | 72 </html> |
OLD | NEW |