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

Unified Diff: sky/framework/animation/curves.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/curves.dart ('k') | sky/framework/animation/timer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/animation/curves.sky
diff --git a/sky/framework/animation/curves.sky b/sky/framework/animation/curves.sky
deleted file mode 100644
index a03d3cfcbc7304521616ad8729759c1e92830675..0000000000000000000000000000000000000000
--- a/sky/framework/animation/curves.sky
+++ /dev/null
@@ -1,55 +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>
-function evaluateCubic(a, b, m) {
- // TODO(abarth): Would Math.pow be faster?
- return 3 * a * (1 - m) * (1 - m) * m + 3 * b * (1 - m) * m * m + m * m * m
-}
-
-const kCubicErrorBound = 0.001;
-
-class Linear {
- transform(t) {
- return t;
- }
-};
-
-class Cubic {
- constructor(a, b, c, d) {
- this.a_ = a;
- this.b_ = b;
- this.c_ = c;
- this.d_ = d;
- Object.preventExtensions(this);
- }
-
- transform(t) {
- var start = 0, end = 1;
- while (1) {
- var midpoint = (start + end) / 2;
- var estimate = evaluateCubic(this.a_, this.c_, midpoint);
-
- if (Math.abs(t - estimate) < kCubicErrorBound)
- return evaluateCubic(this.b_, this.d_, midpoint);
-
- if (estimate < t)
- start = midpoint;
- else
- end = midpoint;
- }
- }
-}
-
-module.exports = {
- Linear: Linear,
- Cubic: Cubic,
- linear: new Linear(),
- ease: new Cubic(0.25, 0.1, 0.25, 1),
- easeIn: new Cubic(0.42, 0, 1, 1),
- easeOut: new Cubic(0, 0, 0.58, 1),
- easeInOut: new Cubic(0.42, 0, 0.58, 1),
-};
-</script>
« no previous file with comments | « sky/framework/animation/curves.dart ('k') | sky/framework/animation/timer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698