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

Unified Diff: sky/examples/spinning-square.sky

Issue 748853004: Add a basic example of a spinning square (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | 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
new file mode 100644
index 0000000000000000000000000000000000000000..8c3fb1ea1655bfae602f4b683f608967922a2722
--- /dev/null
+++ b/sky/examples/spinning-square.sky
@@ -0,0 +1,26 @@
+<sky>
+<style>
+square {
+ margin: 50px;
+ height: 100px;
+ width: 100px;
+ background-color: green;
+}
+</style>
+<square></square>
+<script>
+var square = document.querySelector('square');
+var timeBase = 0;
+
+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);
+}
+
+requestAnimationFrame(animate);
+</script>
+</sky>
« 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