Hyphotesis
I have some circles on a path (see start shape in figure) and they need to animate to another path (end shape in figure).
There are several actions the animation must do:
- move the entire shape to the new position
- change the path
- decrease all circle radii
The figure:
Problem
Raphael.js knows how to animate the circles from the original coordinates to the final ones also changing the radius. Because the animation doesn't run on a similar path like the original and final ones, the animation doesn't look very good. The circles go from x1,y1 to x2,y2 in a straight line.
What I tried
Doing the straight-forward animation, moving the circles from start to end, changing the radius. Like I said, this isn't ok.
Moving every circle in intervals, calculating the new path on every iteration and calculating the position of the circles. This runs very slow.
Calculating a temporary circle position on each iteration with Element.getPointAtLength(). This is also very slow.
Having a few intermediary paths hardcoded in arrays and running the animation through each one. This is better in terms of speed but looks kind of jerky
So, any ideas?
http://irunmywebsite.com/raphael/additionalhelp.php?v=2&q=element.getpointatlength
I'm on iPod so not saying much, but this might help
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.