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

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

Issue 803283006: Add a fps-counter widget to some Sky demos (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
OLDNEW
1 #!mojo mojo:sky_viewer 1 #!mojo mojo:sky_viewer
2 <sky> 2 <sky>
3 <import src="fps-counter.sky" />
3 <style> 4 <style>
4 square { 5 square {
5 margin: 50px; 6 margin: 50px;
6 height: 100px; 7 height: 100px;
7 width: 100px; 8 width: 100px;
8 background-color: green; 9 background-color: green;
9 } 10 }
10 </style> 11 </style>
11 <square></square> 12 <square />
13 <fps-counter showHistory="true" />
12 <script> 14 <script>
13 var square = document.querySelector('square'); 15 var square = document.querySelector('square');
14 var timeBase = 0; 16 var timeBase = 0;
15 17
16 function animate(time) { 18 function animate(time) {
17 if (!timeBase) 19 if (!timeBase)
18 timeBase = time; 20 timeBase = time;
19 var delta = time - timeBase; 21 var delta = time - timeBase;
20 var rotation = Math.floor(delta / 10); 22 var rotation = Math.floor(delta / 10);
21 square.style.transform = 'rotate(' + rotation + 'deg)'; 23 square.style.transform = 'rotate(' + rotation + 'deg)';
22 requestAnimationFrame(animate); 24 requestAnimationFrame(animate);
23 } 25 }
24 26
25 requestAnimationFrame(animate); 27 requestAnimationFrame(animate);
26 </script> 28 </script>
27 </sky> 29 </sky>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698