From 05bc2e9d1f2ba89cab5c84b234d79db03704dbca Mon Sep 17 00:00:00 2001 From: Eric Rowell Date: Mon, 3 Jun 2013 22:09:47 -0700 Subject: [PATCH] Tweens now have built-in point array support. This means thatyou can tween any numeric value, or any array of points. Very handy for Line, spline, Polygon, and Blob --- src/Tween.js | 43 +++++++++++++++++++++++++++++++++++++---- src/shapes/Line.js | 33 ------------------------------- src/shapes/Spline.js | 4 ---- tests/js/manualTests.js | 26 ++++++++++++------------- 4 files changed, 52 insertions(+), 54 deletions(-) diff --git a/src/Tween.js b/src/Tween.js index 1989fbd4..a8ebce69 100644 --- a/src/Tween.js +++ b/src/Tween.js @@ -85,7 +85,7 @@ _addAttrs: function(key, end) { var node = this.node, nodeId = node._id, - tweenId; + start, diff, tweenId, n, len, startVal, endVal; // remove conflict from tween map if it exists tweenId = Kinetic.Tween.tweens[nodeId][key]; @@ -96,22 +96,57 @@ // add to tween map start = node['get' + Kinetic.Util._capitalize(key)](); + + if (Kinetic.Util._isArray(end)) { + end = Kinetic.Util._getPoints(end); + diff = []; + len = end.length; + for (n=0; n