I have a animated CAEmitterLayer with CAEmitterCell and the animation runs well with
fireEmitter = (CAEmitterLayer*)self.layer;
fireEmitter.emitterPosition = CGPointMake(50, 50);
fireEmitter.emitterSize = CGSizeMake(10, 10);
CAEmitterCell* fire = [CAEmitterCell emitterCell];
...
[fire setName:@"fire"];
CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"emitterPosition"];
anim.path = theBezierPath.CGPath;
anim.calculationMode = kCAAnimationCubicPaced;
anim.repeatCount = HUGE_VALF;
anim.duration = 12.0;
[self.layer addAnimation:anim forKey:@"fire"];
my bezier path is closed and forms a "8" out of four position points. with my timerFunction I try to get the position of the CAEmitterLayer every second. for that I use
-(CGPoint)getEmitterPosition
{
return fireEmitter.emitterPosition;
}
in the emitter class and
CGPoint emitterPosition = [self.ParticleEmitterView getEmitterPosition];
NSLog(@"%f / %f", emitterPosition.y, emitterPosition.y);
from the timer function.
But when the animation is running the console spits out the same positio every call allthough the emitter is running over the screen.
why is that and how could I get the emitter position of an animated CAEmitterLayer/Cell?