Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: sky/examples/spinning-square.sky

Issue 840133002: Add the #!mojo to spinning-square.sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!mojo mojo:sky_viewer
1 <sky> 2 <sky>
2 <style> 3 <style>
3 square { 4 square {
4 margin: 50px; 5 margin: 50px;
5 height: 100px; 6 height: 100px;
6 width: 100px; 7 width: 100px;
7 background-color: green; 8 background-color: green;
8 } 9 }
9 </style> 10 </style>
10 <square></square> 11 <square></square>
11 <script> 12 <script>
12 var square = document.querySelector('square'); 13 var square = document.querySelector('square');
13 var timeBase = 0; 14 var timeBase = 0;
14 15
15 function animate(time) { 16 function animate(time) {
16 if (!timeBase) 17 if (!timeBase)
17 timeBase = time; 18 timeBase = time;
18 var delta = time - timeBase; 19 var delta = time - timeBase;
19 var rotation = Math.floor(delta / 10); 20 var rotation = Math.floor(delta / 10);
20 square.style.transform = 'rotate(' + rotation + 'deg)'; 21 square.style.transform = 'rotate(' + rotation + 'deg)';
21 requestAnimationFrame(animate); 22 requestAnimationFrame(animate);
22 } 23 }
23 24
24 requestAnimationFrame(animate); 25 requestAnimationFrame(animate);
25 </script> 26 </script>
26 </sky> 27 </sky>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698