add SampleCode::GetAnimTime() so slides go through a central location for
animation timing. This allows us to "freeze" time in order to do things like
draw multiple times to test clipping.
git-svn-id: http://skia.googlecode.com/svn/trunk@444 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/SampleShapes.cpp b/samplecode/SampleShapes.cpp
index 07f2d00..b92614b 100644
--- a/samplecode/SampleShapes.cpp
+++ b/samplecode/SampleShapes.cpp
@@ -60,8 +60,6 @@
for (size_t i = 0; i < SK_ARRAY_COUNT(fMatrixRefs); i++) {
SkSafeRef(fMatrixRefs[i] = fGroup.getShapeMatrixRef(i));
}
-
- fAngle = 0;
}
virtual ~ShapesView() {
@@ -98,15 +96,15 @@
#endif
}
- int fAngle;
-
virtual void onDraw(SkCanvas* canvas) {
this->drawBG(canvas);
+ SkScalar angle = SampleCode::GetAnimScalar(SkIntToScalar(360)/2,
+ SkIntToScalar(360));
+
SkMatrix saveM = *fMatrixRefs[3];
- fAngle = (fAngle + 5) % 360;
SkScalar c = SkIntToScalar(50);
- fMatrixRefs[3]->preRotate(SkIntToScalar(fAngle), c, c);
+ fMatrixRefs[3]->preRotate(angle, c, c);
SkMatrix matrix;