summaryrefslogtreecommitdiffstats
path: root/src/fx.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-08-30 17:06:00 +0200
committerwout <wout@impinc.co.uk>2014-08-30 17:06:00 +0200
commitbde8508836f9cad16b462c811d124258ca35400d (patch)
treedf79d62041c7afa4a40517f27ddb2a6a45568e63 /src/fx.js
parent6c1820b4c5790be1b0872a49a50d10d97a243292 (diff)
downloadsvg.js-bde8508836f9cad16b462c811d124258ca35400d.tar.gz
svg.js-bde8508836f9cad16b462c811d124258ca35400d.zip
Added animated parametric transformations
Diffstat (limited to 'src/fx.js')
-rwxr-xr-xsrc/fx.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/fx.js b/src/fx.js
index 03e9317..03aec0f 100755
--- a/src/fx.js
+++ b/src/fx.js
@@ -223,15 +223,34 @@ SVG.FX = SVG.invent({
// detect format
if (a == 'transform') {
+ // merge given transformation with an existing one
if (this.attrs[a])
v = this.attrs[a].destination.multiply(v)
+ // prepare matrix for morphing
this.attrs[a] = this.target.ctm().morph(v)
+
+ // add parametric rotation values
+ if (this.param) {
+ // get initial rotation
+ v = this.target.transform('rotation')
+
+ // add param
+ this.attrs[a].param = {
+ from: this.target.param || { rotation: v, cx: this.param.cx, cy: this.param.cy }
+ , to: this.param
+ , initial: v
+ }
+ }
+
} else {
this.attrs[a] = SVG.Color.isColor(v) ?
+ // prepare color for morphing
new SVG.Color(from).morph(v) :
SVG.regex.unit.test(v) ?
+ // prepare number for morphing
new SVG.Number(from).morph(v) :
+ // prepare for plain morphing
{ from: from, to: v }
}
}