diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/fx.js | 19 | ||||
-rw-r--r-- | src/sugar.js | 1 |
2 files changed, 11 insertions, 9 deletions
@@ -95,6 +95,8 @@ SVG.extend(SVG.FX, { else this.attrs[a] = { from: this.target.attr(a), to: v }; + + return this; }, // animated transformations @@ -172,20 +174,19 @@ SVG.extend(SVG.FX, { // private: tween color _color: function(o, p) { - // convert hex to rgb and store it for further reference - if (typeof o.from !== 'object') - o.from = this._h2r(o.from || '#000'); + var f, t; - // convert hex to rgb and store it for further reference + // convert FROM hex to rgb + f = this._h2r(o.from || '#000'); - if (typeof o.to !== 'object') - o.to = this._h2r(o.to); + // convert TO hex to rgb + t = this._h2r(o.to); // tween color and return hex return this._r2h({ - r: ~~(o.from.r + (o.to.r - o.from.r) * p), - g: ~~(o.from.g + (o.to.g - o.from.g) * p), - b: ~~(o.from.b + (o.to.b - o.from.b) * p) + r: ~~(f.r + (t.r - f.r) * p), + g: ~~(f.g + (t.g - f.g) * p), + b: ~~(f.b + (t.b - f.b) * p) }); }, diff --git a/src/sugar.js b/src/sugar.js index c6b5c75..222a8b8 100644 --- a/src/sugar.js +++ b/src/sugar.js @@ -41,6 +41,7 @@ SVG.extend(SVG.Shape, { }); + // Add element-specific functions SVG.extend(SVG.Element, { |