-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
continuous morphing over several paths #9
Comments
You should definitely try verstion 3 of svg.js as soon as it is out. We have conroller there which can give you a continous animation. Actually you could test it already. You need to check out the 776-new-fx branch. It should work for path morphing as long as you dont use this plugin but the basic path morph (same command length, same commands). However, to just see how it works, try a polygon first: let canvas = SVG().addTo('#canvas').size('100%', '100%')
var randPoint = (x = 50, y = 50) => [
Math.random() * 100 - 50 + x,
Math.random() * 100 - 50 + y
]
var poly = canvas.polygon([
randPoint(),
randPoint(),
randPoint(),
randPoint(),
randPoint()
]).attr({fill: 'none', stroke: 'black'})
var polyAni = poly.animate(new SVG.PID(0.01, 0.01))
SVG.on(document, 'click', function (e) {
polyAni.plot([
randPoint(e.pageX-50, e.pageY-50),
randPoint(e.pageX+50, e.pageY-50),
randPoint(e.pageX+50, e.pageY),
randPoint(e.pageX+50, e.pageY+50),
randPoint(e.pageX-50, e.pageY+50)
])
}) // EDIT: To try this example, edit the dirty file which is our working file to test stuff |
Thank you for replying. I'll test it as soon as I find the time. Is there any estimated release date for v3 ? |
Not yet. We are both short on time but try to work continuously on it |
dear @Fuzzyma , I see that svg.js 3 has been released and it is being constantly updated. I would like to ask if continuous morphin is, as you suggested, possible with v3 and if I should try it. As I understanded your previous answer, I should not use this plugin but animate 'plot' ? Thank you and congratulations for the amazing work. |
Yes it is possible. This plugin however is not designed to work with version 3. But even without it, you have basic animation propabilities for paths. Just make sure, that your path commands are the same. For the continous animations see this example: https://codepen.io/fuzzyma/pen/bOWdrp const poly = mask.polyline(initialData).animate(new SVG.Spring(700))
poly.plot(data) The above example is ofc for a polyline but paths should work the same // EDIT: To see the continous animation in the example, use the slider to slide around the datapoints |
Thank you. In the case of paths, am I going to be limited by number of points as it is usually the case ? |
You are limited by your users performance so dont overdo it. Simple paths work best! |
Sorry, I meant if I am limited to animating/morphing among paths that share the same number of points. Thanks ! |
Yes, same path commands, same number - because this plugin wasnt renewed |
When chaining morphs , one can see where the endpoint/startpoint for every morph are, usually because of a change of "direction" of the morph, would there be any way of making the morphing "continuous" ?
I am trying this for shapes that share the same ammount of points. They are actually versions of the same shape. Some sort of abstract blob.
The code looks something like this:
Thank you
The text was updated successfully, but these errors were encountered: