Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!mojo mojo:sky_viewer | |
| 2 <sky> | |
| 3 <style> | |
| 4 square { | |
| 5 margin: 50px; | |
| 6 height: 100px; | |
| 7 width: 100px; | |
| 8 background-color: green; | |
| 9 } | |
| 10 </style> | |
| 11 <square /> | |
| 12 <script> | |
| 13 import "dart:sky"; | |
| 14 | |
| 15 void main() { | |
| 16 Element square = document.querySelector('square'); | |
| 17 double timeBase = null; | |
| 18 | |
| 19 void animate(double time) { | |
| 20 if (timeBase == null) | |
| 21 timeBase = time; | |
| 22 double delta = time - timeBase; | |
| 23 int rotation = (delta / 10).floor(); | |
| 24 square.style["transform"] = "rotate(${rotation}deg)"; | |
| 25 window.requestAnimationFrame(animate); | |
| 26 } | |
| 27 | |
| 28 window.requestAnimationFrame(animate); | |
| 29 } | |
| 30 </script> | |
| 31 </sky> | |
| OLD | NEW |