Switch scheduler over to Duration

This patch prepares us to switch to using integers when handing off the
animation time from the engine to the framework.
This commit is contained in:
Adam Barth
2015-10-03 10:55:25 -07:00
parent 472c440396
commit db191e96bd
8 changed files with 28 additions and 27 deletions

View File

@@ -9,7 +9,7 @@ import 'package:sky/rendering.dart';
import 'solid_color_box.dart';
double timeBase;
Duration timeBase;
RenderTransform transformBox;
void main() {
@@ -34,10 +34,10 @@ void main() {
scheduler.addPersistentFrameCallback(rotate);
}
void rotate(double timeStamp) {
void rotate(Duration timeStamp) {
if (timeBase == null)
timeBase = timeStamp;
double delta = (timeStamp - timeBase) / 1000; // radians
double delta = (timeStamp - timeBase).inMicroseconds.toDouble() / Duration.MICROSECONDS_PER_SECOND; // radians
transformBox.setIdentity();
transformBox.translate(transformBox.size.width / 2.0, transformBox.size.height / 2.0);

View File

@@ -54,13 +54,13 @@ Widget builder() {
);
}
double timeBase;
Duration timeBase;
RenderTransform transformBox;
void rotate(double timeStamp) {
void rotate(Duration timeStamp) {
if (timeBase == null)
timeBase = timeStamp;
double delta = (timeStamp - timeBase) / 1000; // radians
double delta = (timeStamp - timeBase).inMicroseconds.toDouble() / Duration.MICROSECONDS_PER_SECOND; // radians
transformBox.setIdentity();
transformBox.translate(transformBox.size.width / 2.0, transformBox.size.height / 2.0);