Skip to content
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

Morphing Shape with Path and Animate #5

Closed
kevin7 opened this issue Feb 27, 2013 · 15 comments
Closed

Morphing Shape with Path and Animate #5

kevin7 opened this issue Feb 27, 2013 · 15 comments

Comments

@kevin7
Copy link

kevin7 commented Feb 27, 2013

does SVG.js support this:
http://svg-mitchallen.blogspot.com.au/2005/03/morphing-shapes-in-svg.html

I read through the documentation, but I couldn't seem to find something related to it.

@wout
Copy link
Member

wout commented Feb 27, 2013

I am working on a morph plugin that will use this technique but it is not yet ready for release.

@kevin7
Copy link
Author

kevin7 commented Feb 27, 2013

oh.. cool, do you have an ETA. I'm from queness.com, and working on a tutorial about this plugin. btw, good job.

@wout
Copy link
Member

wout commented Feb 27, 2013

In fact it is already working but I need to overcome one problem. I can't really give an ETA because the plugin can only be released when I found a decent solution. This can be tomorrow or next month.

@kevin7
Copy link
Author

kevin7 commented Feb 27, 2013

Ok, looking forward to it.

@wout
Copy link
Member

wout commented Feb 27, 2013

If you need any help on the tutorial, please let me know.
I am looking forward to it.
Thanks.

@hyperboreans
Copy link

@wout why don't you tell us what is the problem? You might find help :-)

@wout
Copy link
Member

wout commented Mar 2, 2013

Well, my main concern with SMIL animations is that they are difficult to control. For example, you can't simply stop an animation halfway the defined duration. In case of a path morph that would result in the element returning to its initial state, or at best with a bit of tweaking to its destination. This is a huge problem if you want to use those animations in combination with mouse events.

Another, more dramatic problem with SMIL is that if paths get complicated no animation happens at all. It seems points in a path needs to match. The result is a hard switch from one shape to the other at the end of the given duration.

Therefore I am looking into forging a path recalculation module. This will take more time and it's a lot more complex but it will be much more flexible and it will integrate nicely with our the built-in SVG.FX module.

@hyperboreans
Copy link

So the problem is realizing the animations while sticking to SMIL -- while as far as I can see most of the libraries out there (Raphael, D3) simply keep track of the animation in the code and modify the attributes in the SVG accordingly (e.g. on a frame-by-frame basis).

A "dummy" path recalculation function should be an easy task, if one is not too picky 😄. I wrote a piece of code that does exactly that by simply adding points to the original path without modifying its appearance, such that the total count of points before/after the animation stays the same. That was enough in the context I wrote it for. I would advise against more complex solutions, unless the result is a simple and flexible way for the developer to specify what section of the path should be "affected" by the animation.

@wout
Copy link
Member

wout commented Mar 3, 2013

Yes, the questions was about SMIL animations. I have briefly walked this path but quickly realised that SMIL is absolutely not the way to go. In fact I don't think there is any future for it unless they would completely rewrite SMIL to make it dynamically controllable.

I have also looked at path tweening/recalculations and it is absolutely manageable. Although time is not on my hands an I am developing svg.js as I go. Currently I am only implementing features when I need them myself. Of course I would love to add some fancy features and any help with that would be greatly appreciated.

My plan is to add this kind of functionality in a plugin. Any interest in working together on this?

@hyperboreans
Copy link

Sure, I can spend some time (few hours per week) on this. I'm only afraid a plugin is not enough if we need to work on individual points of the paths. As soon as you have an initial idea for the design of the plugin just let me know and let's move on from there.

@wout
Copy link
Member

wout commented Mar 5, 2013

There is no difference to a plugin or native modules in svg.js. It's architecture allows extension of core classes without limitations. I will set up a draft so we can work from there.

@wout wout closed this as completed May 24, 2013
@marthijn
Copy link

Any news on this guys? I'm interested in this functionality as well!

@wout
Copy link
Member

wout commented Jun 27, 2013

The good news is that it will be a plugin. The bad news is that I have very little time on my hands, so no ETA.

@marthijn
Copy link

Any chance you can send me an early development version? I really need it! :-)

@wout
Copy link
Member

wout commented Jun 27, 2013

I would but I haven't started yet :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants