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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/examples/dart-mojo.sky ('k') | sky/framework/dom-serializer.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/spinning-square.sky
diff --git a/sky/examples/spinning-square.sky b/sky/examples/spinning-square.sky
index c5239406677ab842eefec62e582641d4ca075790..673716b738fe7e731182d810f83d10f301c60989 100644
--- a/sky/examples/spinning-square.sky
+++ b/sky/examples/spinning-square.sky
@@ -1,6 +1,5 @@
#!mojo mojo:sky_viewer
<sky>
-<import src="fps-counter.sky" />
<style>
square {
margin: 50px;
@@ -10,20 +9,23 @@ square {
}
</style>
<square />
-<fps-counter showHistory="true" />
<script>
-var square = document.querySelector('square');
-var timeBase = 0;
+import "dart:sky";
-function animate(time) {
- if (!timeBase)
- timeBase = time;
- var delta = time - timeBase;
- var rotation = Math.floor(delta / 10);
- square.style.transform = 'rotate(' + rotation + 'deg)';
- requestAnimationFrame(animate);
-}
+void main() {
+ Element square = document.querySelector('square');
+ double timeBase = null;
+
+ void animate(double time) {
+ if (timeBase == null)
+ timeBase = time;
+ double delta = time - timeBase;
+ int rotation = (delta / 10).floor();
+ square.style.setProperty("transform", 'rotate(${rotation}deg)');
+ window.requestAnimationFrame(animate);
+ }
-requestAnimationFrame(animate);
+ window.requestAnimationFrame(animate);
+}
</script>
</sky>
« 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