可以刷新 animateAlong 以及异构 RaphaelJS 集

发布于 2024-11-26 09:27:05 字数 541 浏览 7 评论 0原文

我最近开始玩 RaphaelJS。我试图找到最好的最简单的方法来为一组异构的拉斐尔对象制作动画,或者一种类似的方法。

我已经在 http://jsfiddle.net/maraujop/Prckt 设置了我正在尝试的基本示例/

问题是我希望狙击镜在有人点击目标(蓝色圆圈)后跟随它。现在,狙击瞄准镜在单击时会到达目标所在的位置,但不会跟随。

当然,我可以使用与目标相同的路线animateAlong狙击范围(这将是一个黑客,不是通用解决方案),但想象目标随机移动,我需要将狙击手重新绘制到哪里圆圈移动。

看起来我无法在 onAnimation 中使用 animateAlong (可能太多了?)。所以我猜测正确的方法是将 sniper 转换为一个 SVG 路径并使用 attrtranslate

有人可以解释一下吗?谢谢

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

灼疼热情 2024-12-03 09:27:05

我发现解决这个问题的一种方法是创建一组 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文