可以刷新 animateAlong 以及异构 RaphaelJS 集
我最近开始玩 RaphaelJS。我试图找到最好的最简单的方法来为一组异构的拉斐尔对象制作动画,或者一种类似的方法。
我已经在 http://jsfiddle.net/maraujop/Prckt 设置了我正在尝试的基本示例/
问题是我希望狙击镜在有人点击目标(蓝色圆圈)后跟随它。现在,狙击瞄准镜在单击时会到达目标所在的位置,但不会跟随。
当然,我可以使用与目标相同的路线animateAlong
狙击范围(这将是一个黑客,不是通用解决方案),但想象目标随机移动,我需要将狙击手重新绘制到哪里圆圈移动。
看起来我无法在 onAnimation
中使用 animateAlong
(可能太多了?)。所以我猜测正确的方法是将 sniper 转换为一个 SVG 路径并使用 attr
或 translate
。
有人可以解释一下吗?谢谢
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 to 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现解决这个问题的一种方法是创建一组 Raphael 对象并沿同一方向独立移动它们。
第二种方法是使用相对路径,并更新其路径来移动它,使用计时器来重绘路径。
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.