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

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

Issue 942413002: Port sky-drawer to Dart (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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/timer.dart ('k') | sky/framework/sky-drawer.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/animation/timer.sky
diff --git a/sky/framework/animation/timer.sky b/sky/framework/animation/timer.sky
deleted file mode 100644
index 31583e05736038bc209bd6000431ca006cb4ba38..0000000000000000000000000000000000000000
--- a/sky/framework/animation/timer.sky
+++ /dev/null
@@ -1,49 +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.
--->
-<script>
-module.exports = class AnimationTimer {
- constructor(delegate) {
- this.delegate_ = delegate;
- this.startTime_ = 0;
- this.duration_ = 0;
- this.animationId_ = 0;
- Object.preventExtensions(this);
- }
-
- start(duration) {
- if (this.animationId_)
- this.stop();
- this.duration_ = duration;
- this.scheduleTick_();
- }
-
- stop() {
- cancelAnimationFrame(this.animationId_);
- this.startTime_ = 0;
- this.duration_ = 0;
- this.animationId_ = 0;
- }
-
- scheduleTick_() {
- if (this.animationId_)
- throw new Error("Tick already scheduled.");
- this.animationId_ = requestAnimationFrame(this.tick_.bind(this));
- }
-
- tick_(timeStamp) {
- this.animationId_ = 0;
- if (!this.startTime_)
- this.startTime_ = timeStamp;
- var elapsedTime = timeStamp - this.startTime_;
- var t = Math.max(0, Math.min(1, elapsedTime / this.duration_));
- if (t < 1)
- this.scheduleTick_();
- else
- this.stop();
- this.delegate_.updateAnimation(t);
- }
-};
-</script>
« no previous file with comments | « sky/framework/animation/timer.dart ('k') | sky/framework/sky-drawer.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698