diff options
author | Saivan <savian@me.com> | 2018-09-17 14:10:12 +1000 |
---|---|---|
committer | Saivan <savian@me.com> | 2018-09-17 14:10:12 +1000 |
commit | 791bb2bab91a022d1b5265b40faa997ad9938ad7 (patch) | |
tree | 6f0a9515b43312efeb51f70463063e21fd078ed5 /dirty.html | |
parent | a4c502febf836f02c13a8c1550632eeed09476da (diff) | |
download | svg.js-791bb2bab91a022d1b5265b40faa997ad9938ad7.tar.gz svg.js-791bb2bab91a022d1b5265b40faa997ad9938ad7.zip |
Fixed the relative non-affine transform animations
This commit uncovered an issue with the relative non-affine transformations. It is
now correctly fixed and working. Next we should fix the affine transforms as well.
Changes
=======
- Fixed the relative non-affine transformation animations
Diffstat (limited to 'dirty.html')
-rw-r--r-- | dirty.html | 49 |
1 files changed, 31 insertions, 18 deletions
@@ -25,7 +25,7 @@ <div id="position"><label>Position: <input type="range" min="0" max="5" step="0.01"></slider></label><span></span></div> <!-- Making the svg --> -<svg width=1000px height=1000px id="canvas" viewbox="-1000 -1000 3000 3000"> +<svg width=1000px height=1000px id="canvas" viewbox="-1000 -2000 5000 5000"> <rect x=50 y=100 width=200 height=100 stroke=none stroke-width=2 /> </svg> @@ -295,6 +295,7 @@ let canvas = SVG('#canvas') // }) // +canvas.ellipse(20, 20).center(100, 100) let r = canvas.rect(200, 400).move(100, 100) .attr('opacity', 0.3) .transform({ tx: 300, ty: 500, origin: 'top-left' }) @@ -304,26 +305,38 @@ let wait = 1000 let rAnim = r.clone().attr('fill', '#f00').animate(wait).attr('fill', '#0f0') let rDecl = r.clone().attr('fill', 'blue').animate(new SVG.Spring(wait, 15)) -// Move once -setTimeout(() => { - let trans = {tx: 500, ty: 300} - r.transform(trans, true) - rAnim.animate(wait, 0, 'start').transform(trans, true) - //rDecl.transform(trans, true) -}, wait) - -// Move again +// // Move once // setTimeout(() => { -// let trans = {rotate: 300} +// let trans = {tx: 500, ty: 300} // r.transform(trans, true) -// rAnim.animate(wait).transform(trans, true) -// //rDecl.transform(trans, true) -// }, 1.5 * wait ) - - - - +// // rAnim.animate(wait, 0, 'start').transform(trans, true) +// rDecl.transform(trans, true) +// }, wait) +// Move again +setTimeout(() => { + let transform = { + origin: 'top-left', + translate: [530, 250], + rotate: 300, + scale: 2, + shear: 1, + } + let relative = true + let affine = false + r.transform(transform, relative) + rAnim.animate(wait).transform(transform, relative, affine) + rDecl.transform(transform, relative, affine) +}, 0.1 * wait ) + + +// declaritive relative (affine/nonaffine) +// declaritive absolute non affine +// normal non affine relative + +// D N +// R +// A |