Chromium Code Reviews| 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..00aeb0f2e50dd412e2d6ae208eae103baef4c831 |
| --- /dev/null |
| +++ b/sky/sdk/lib/base/lerp.dart |
| @@ -0,0 +1,17 @@ |
| +// 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 * (1.0 - t) + b * t; |
| + |
| +Color lerpColor(Color a, Color b, double t) => |
| + 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) => |
| + new Offset(lerpNum(a.dx, b.dx, t), |
| + lerpNum(a.dy, b.dy, t)); |
|
abarth-chromium
2015/06/30 22:26:09
Should these functions be on Color and Offset, res
Matt Perry
2015/07/01 18:17:43
Yeah I dunno.. lerp doesn't feel important enough
|