Possible to refresh an animateAlong with an heterogeneous RaphaelJS set
I have recently started to play with RaphaelJS. I'm trying to find the best easiest way to animate an heterogeneous group of Raphael objects, or a way to something similar.
I've set up a basic example of what I'm trying at http://jsfiddle.net/maraujop/Prckt/
The thing is that I want the sniper scope t开发者_开发技巧o follow the target (the blue circle) after somebody clicks on it. Right now the sniper scope goes to where the target is when clicking, but doesn't follow.
Of course I could animateAlong
the sniper scope using the same route as the target (would be a hack, not a universal solution), but imagine the target moves random, I would need to redraw the sniper to where the circle moves.
It looks like I can't use animateAlong
in onAnimation
(might be too much?). So I'm guessing that the right way to do this would be turning sniper into one single SVG path and use attr
or translate
.
Can someone shed some light on this? Thanks
One way I've found to solve this is create a group of Raphael objects and move them independently in the same direction.
Second way is to use a relative path, and update its path to move it, using a timer to redraw the path.
精彩评论