diff options
author | wout <wout@impinc.co.uk> | 2014-08-30 17:06:00 +0200 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-08-30 17:06:00 +0200 |
commit | bde8508836f9cad16b462c811d124258ca35400d (patch) | |
tree | df79d62041c7afa4a40517f27ddb2a6a45568e63 /src/fx.js | |
parent | 6c1820b4c5790be1b0872a49a50d10d97a243292 (diff) | |
download | svg.js-bde8508836f9cad16b462c811d124258ca35400d.tar.gz svg.js-bde8508836f9cad16b462c811d124258ca35400d.zip |
Added animated parametric transformations
Diffstat (limited to 'src/fx.js')
-rwxr-xr-x | src/fx.js | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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 } } } |