如何在 Raphael 中结合图像和矢量动画
我正在尝试用 R 为一些东西制作动画。所以我得到了一个可以制作动画的 PNG,但我想在 PNG 周围放置一个圆圈并将两者作为一个制作动画。
我知道可以用这样的集合来做到这一点:
this.ship = paper.set();
this.ship.push(
paper.circle(116, 116, 20).attr("fill", "#ff0"),
paper.image("assets/img/ship.png", 100, 100, 32, 32)
);
然后:
{
this.ship[i].animate ...
}
...但这就是两个元素属性差异的恼人原因。
有人暗示什么是开始的好方法吗?谢谢!
I'm trying to animate some stuff with R. So i got a PNG which i can animate, but i want to put a circle around the PNG and animate the two as one.
I know one can do it with a set like:
this.ship = paper.set();
this.ship.push(
paper.circle(116, 116, 20).attr("fill", "#ff0"),
paper.image("assets/img/ship.png", 100, 100, 32, 32)
);
and then:
{
this.ship[i].animate ...
}
...but thats anoying cause of the differences in the attribs of the both elements.
Does someone has a hint what would be a good way to start with? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据我的理解, paper.set 能够处理动画,
否则在这种情况下你不应该使用 paper.set 。我建议使用 animateWith
请参阅: http://raphaeljs.com/reference.html#animateWith
In my understanding a paper.set is able to handle animations like
otherwise you shouldn't use paper.set in this case. i suggest to use animateWith
see: http://raphaeljs.com/reference.html#animateWith