| 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>
|
|
|