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?
Asked
Active
Viewed 1,980 times
3 Answers
3
You can use a CAKeyframeAnimation to animate the emitterPosition:
CAKeyframeAnimation *particleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"emitterPosition"];
[particleAnimation setPath:yourPath];
[particleAnimation setDuration:1.0];
[particleAnimation setCalculationMode:kCAAnimationPaced];
[yourEmitterLayer addAnimation:particleAnimation forKey:@"yourAnimation"];

Marco
- 330
- 5
- 13
-
Hi, how do you use with the CAEmitterCell ? – Jules Jun 12 '14 at 07:06
0
yourEmitter.emitterShape = kCAEmitterLayerCircle;
yourEmitter.emitterMode = kCAEmitterLayerOutline;

walker
- 140
- 1
- 8