Index: sky/examples/raw/spinning_image.dart |
diff --git a/sky/examples/raw/spinning_square.dart b/sky/examples/raw/spinning_image.dart |
similarity index 66% |
copy from sky/examples/raw/spinning_square.dart |
copy to sky/examples/raw/spinning_image.dart |
index 17072330d56a229ea035b708aba5d86df568c8ef..53fe140460f3b4dbc19e556d937e50c582b77596 100644 |
--- a/sky/examples/raw/spinning_square.dart |
+++ b/sky/examples/raw/spinning_image.dart |
@@ -6,20 +6,24 @@ import 'dart:sky'; |
double timeBase = null; |
+Image image; |
+ |
void beginFrame(double timeStamp) { |
- if (timeBase == null) |
- timeBase = timeStamp; |
+ if (timeBase == null) timeBase = timeStamp; |
double delta = timeStamp - timeBase; |
PictureRecorder canvas = new PictureRecorder(view.width, view.height); |
canvas.translate(view.width / 2.0, view.height / 2.0); |
canvas.rotateDegrees(delta / 10); |
- canvas.drawRect(new Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0), |
- new Paint()..setARGB(255, 0, 255, 0)); |
+ canvas.scale(0.2, 0.2); |
+ Paint paint = new Paint()..setARGB(255, 0, 255, 0); |
+ canvas.drawImage(image, -image.width / 2.0, -image.height / 2.0, paint); |
view.picture = canvas.endRecording(); |
view.scheduleFrame(); |
} |
void main() { |
+ image = new Image(); |
+ image.src = "https://www.dartlang.org/logos/dart-logo.png"; |
view.setBeginFrameCallback(beginFrame); |
view.scheduleFrame(); |
} |