Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Unified Diff: sky/framework/animation/timer.dart

Issue 1001373002: Organize sky/framework/animation (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/framework/animation/simulation.dart ('k') | sky/framework/components/drawer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/animation/timer.dart
diff --git a/sky/framework/animation/timer.dart b/sky/framework/animation/timer.dart
deleted file mode 100644
index f4bfd5d91d01c01bdf060cde41ab4c0c255c3eee..0000000000000000000000000000000000000000
--- a/sky/framework/animation/timer.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import "dart:math" as math;
-import "dart:sky" as sky;
-
-abstract class AnimationDelegate {
- void updateAnimation(double t);
-}
-
-class AnimationTimer {
- final AnimationDelegate _delegate;
- double _startTime = 0.0;
- double _duration = 0.0;
- int _animationId = 0;
-
- AnimationTimer(this._delegate);
-
- void start(double duration) {
- if (_animationId != 0)
- stop();
- _duration = duration;
- _scheduleTick();
- }
-
- void stop() {
- sky.window.cancelAnimationFrame(_animationId);
- _startTime = 0.0;
- _duration = 0.0;
- _animationId = 0;
- }
-
- void _scheduleTick() {
- assert(_animationId == 0);
- _animationId = sky.window.requestAnimationFrame(_tick);
- }
-
- void _tick(double timeStamp) {
- _animationId = 0;
- if (_startTime == 0.0)
- _startTime = timeStamp;
- double elapsedTime = timeStamp - _startTime;
- double t = math.max(0.0, math.min(1.0, elapsedTime / _duration));
- if (t < 1.0)
- _scheduleTick();
- else
- stop();
- _delegate.updateAnimation(t);
- }
-}
« no previous file with comments | « sky/framework/animation/simulation.dart ('k') | sky/framework/components/drawer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698