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

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

Issue 922893002: Merge the Sky Engine changes from the SkyDart branch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « sky/examples/dart-mojo.sky ('k') | sky/framework/dom-serializer.sky » ('j') | 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 #!mojo mojo:sky_viewer
2 <sky> 2 <sky>
3 <import src="fps-counter.sky" />
4 <style> 3 <style>
5 square { 4 square {
6 margin: 50px; 5 margin: 50px;
7 height: 100px; 6 height: 100px;
8 width: 100px; 7 width: 100px;
9 background-color: green; 8 background-color: green;
10 } 9 }
11 </style> 10 </style>
12 <square /> 11 <square />
13 <fps-counter showHistory="true" />
14 <script> 12 <script>
15 var square = document.querySelector('square'); 13 import "dart:sky";
16 var timeBase = 0;
17 14
18 function animate(time) { 15 void main() {
19 if (!timeBase) 16 Element square = document.querySelector('square');
20 timeBase = time; 17 double timeBase = null;
21 var delta = time - timeBase; 18
22 var rotation = Math.floor(delta / 10); 19 void animate(double time) {
23 square.style.transform = 'rotate(' + rotation + 'deg)'; 20 if (timeBase == null)
24 requestAnimationFrame(animate); 21 timeBase = time;
22 double delta = time - timeBase;
23 int rotation = (delta / 10).floor();
24 square.style.setProperty("transform", 'rotate(${rotation}deg)');
25 window.requestAnimationFrame(animate);
26 }
27
28 window.requestAnimationFrame(animate);
25 } 29 }
26
27 requestAnimationFrame(animate);
28 </script> 30 </script>
29 </sky> 31 </sky>
OLDNEW
« no previous file with comments | « sky/examples/dart-mojo.sky ('k') | sky/framework/dom-serializer.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698