summaryrefslogtreecommitdiffstats
path: root/src/color.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-01-31 19:01:16 +0100
committerwout <wout@impinc.co.uk>2014-01-31 19:01:16 +0100
commit859bbecc67cbb0d81cf8639c4cfefbf39151faef (patch)
tree3fd18fbcad4a7a480e1a2b14b7cabe5d4aa8c8ef /src/color.js
parenta7288d90d3eb6529f635259d48084f407f81ca36 (diff)
downloadsvg.js-859bbecc67cbb0d81cf8639c4cfefbf39151faef.tar.gz
svg.js-859bbecc67cbb0d81cf8639c4cfefbf39151faef.zip
Fix in color morphing
Diffstat (limited to 'src/color.js')
-rwxr-xr-xsrc/color.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/color.js b/src/color.js
index 9821743..d870d5f 100755
--- a/src/color.js
+++ b/src/color.js
@@ -71,6 +71,9 @@ SVG.extend(SVG.Color, {
/* make sure a destination is defined */
if (!this.destination) return this
+ /* normalise pos */
+ pos = pos < 0 ? 0 : pos > 1 ? 1 : pos
+
/* generate morphed array */
return new SVG.Color({
r: ~~(this.r + (this.destination.r - this.r) * pos)