使用 CAEmitterLayer 围绕圆或 CGPath 绘制粒子
我正在尝试使用 iOS 5 的粒子系统(CAEmitterLayer 和 CAEmitterCell)围绕圆(或者更好的是 CGPath)绘制粒子,但我不知道该怎么做。我能做的最好的事情就是制作一个圆弧(通过修改 CAEmitterCell 的 yAcceleration 属性),但我无法制作一个完整的圆。当然,我可以做多个圆弧来模拟圆,但“结”非常明显。另外,我不想使用蒙版,因为看起来边缘的粒子被裁剪了。有什么想法如何做到这一点吗?
I'm trying to use iOS 5's particle system (CAEmitterLayer and CAEmitterCell) to draw particles around a circle (or even better, a CGPath), but I don't know how to do it. The best I could do is make an arc (by modifying the yAcceleration property of CAEmitterCell), but I can't do a complete circle. Of course, I could do multiple arcs to simulate a circle, but the "knots" are very visible. Also, I don't want to use masks, because it would seem like the particles at the edges are cropped. Any ideas how to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用 CAKeyframeAnimation 来为发射器位置设置动画:
You can use a CAKeyframeAnimation to animate the emitterPosition:
您想要使用粒子Emitter.emitterShape = kCAEmitterLayerCircle
http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CAEmitterLayer_class/Reference/Reference.html
You want to use
particleEmitter.emitterShape = kCAEmitterLayerCircle
http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CAEmitterLayer_class/Reference/Reference.html