objective c - how to get the emitter position of an animated CAEmitterLayer/Cell? -
i have animated caemitterlayer caemittercell , animation runs 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 closed , forms "8" out of 4 position points. timerfunction try position of caemitterlayer every second. use
-(cgpoint)getemitterposition { return fireemitter.emitterposition; } in emitter class ,
cgpoint emitterposition = [self.particleemitterview getemitterposition]; nslog(@"%f / %f", emitterposition.y, emitterposition.y); from timer function.
but when animation running console spits out same positio every call allthough emitter running on screen.
why , how emitter position of animated caemitterlayer/cell?
have tried querying caemitterlayer's presentationlayer property , asking resulting calayer position? presentation layer should give access properties of layer appear on screen during animation, while emitter layer give properties @ end of current animations.
this due model-view separation inherent in core animation's rendering architecture.
Comments
Post a Comment