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

Unified Diff: sky/sdk/lib/base/lerp.dart

Issue 1211603003: Baby steps towards an odeon-like animation system. First victim: Drawer. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: abarth Created 5 years, 6 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/sdk/lib/animation/generators.dart ('k') | sky/sdk/lib/painting/box_painter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/base/lerp.dart
diff --git a/sky/sdk/lib/base/lerp.dart b/sky/sdk/lib/base/lerp.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c40934c024b8acf38d0343f66fa9cce123011326
--- /dev/null
+++ b/sky/sdk/lib/base/lerp.dart
@@ -0,0 +1,19 @@
+// 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:sky';
+
+num lerpNum(num a, num b, double t) => a + (b - a) * t;
+
+Color lerpColor(Color a, Color b, double t) {
+ return new Color.fromARGB(
+ lerpNum(a.alpha, b.alpha, t).toInt(),
+ lerpNum(a.red, b.red, t).toInt(),
+ lerpNum(a.green, b.green, t).toInt(),
+ lerpNum(a.blue, b.blue, t).toInt());
+}
+
+Offset lerpOffset(Offset a, Offset b, double t) {
+ return new Offset(lerpNum(a.dx, b.dx, t), lerpNum(a.dy, b.dy, t));
+}
« no previous file with comments | « sky/sdk/lib/animation/generators.dart ('k') | sky/sdk/lib/painting/box_painter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698