flutter/examples/spinning-square.sky
Adam Barth deedba409a Merge the Sky Engine changes from the SkyDart branch
This CL flips the switch to make Sky use Dart.

TBR=eseidel@chromium.org
BUG=454613

Review URL: https://codereview.chromium.org/922893002
2015-02-12 15:06:03 -08:00

32 lines
600 B
Plaintext

#!mojo mojo:sky_viewer
<sky>
<style>
square {
margin: 50px;
height: 100px;
width: 100px;
background-color: green;
}
</style>
<square />
<script>
import "dart:sky";
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);
}
window.requestAnimationFrame(animate);
}
</script>
</sky>