ios - How to synchronize another object with a repeating animation? -


I have an animation in which an object bumps with two seconds between two consecutive walls between two seconds The condition of CGPontts is that the code to do this by start and 'positionInd' is very simple and original animation:

  cbisis animation * animation; TheAnimation = [with CABasic Animation Animation: @ "Status"]; TheAnimation.duration = 1.0; TheAnimation.beginTime = CACurrentMediaTime () + 1; TheAnimation.repeatCount = HUGE_VALF; TheAnimation.autoreverses = yes; TheAnimation.fromValue = [NSValue Value WithCGPoint: positionStart]; TheAnimation.toValue = [NSValue Value withCGPoint: positionEnd]; [Self.pulseLayer addAnimation: theAnimation forKey: @ "animatePosition"];   

Now this is the question: I have to code this code, with every "tick" of this clock to send a message to another object; Which is, every time the position of the pulseLayer goes to 'positionStart', I want this part of the code to send a target action message to another object (say it called clock # 2) with which I periodic bounce Want to keep in sync 'Pulsar'

Is there any easy way to do this? The best alternate idea is that I can send the "clock" time pulses to # 2 to start this animation (1) at the same time to start NSTIMER, but I worry that although the NSTimer object and the 'Pulsar' bounce is locked in sync It may be that the smallest time errors continue to increase over time so that they do not appear in sync after a long time. Certainly there would be nothing to force them to stay synchronized. Another idea (2) (ie, change the anonymization.repeatCount of equal to 0) and time pulses both for this object and for every 2 seconds To start a bounce animation, send another object to eliminate this endless bounce of the pulseLayer "clock # 2" object that I want to keep in sync

What I want to do here To implement Any idea about the best way?

does not send autorowers notification

(Unless all animation is complete , Which is never in the example above)

Use 2 different animations, it is easy to set up:

Setup:

  // to self.toAnimation = [CABasicAnimation animationWithKeyPath: @ "status"]; Self.toAnimation.duration = 1.0; Auto.timation.frval value = [nsvilite valueWithCGPoint: statusstart]; Self.toAnimation.toValue = [NSValue valueWithCGP: positionEnd]; Self.toAnimation.delegate: Self; // and fro self.fro animation = [with CABasic animation animation: @ "status"]; Self.froAnimation.duration = 1.0; Self.froAnimation.fromValue = [NSValue Value withCGPoint: positionEnd]; Self.froAnimation.toValue = [NSValue Value WithCGPoint: positionStart]; Self.froAnimation.delegate: Self; Start the series of animations by adding animation (first) [first] (first) (auto) andFFF to < : Self.froAnimation];  Representative:   
  - (zero) animationDidStop: (CAAnimation *) Animation ended: (bool) expired { [Self ToAndFro: (CABasicAnimation *) Animation]; }  Core:   
  - (zero) toAndFro: (CABasicAnimation *) stoppedAnimation {BOOL wasFro = self.froAnimation = = Stop animation; CABasicAnimation * theAnimation = ((Fawn)? Self. Animation: self.fro animation); [Self.pulseLayer addAnimation: theAnimation forKey: @ "animatePosition"]; // Tick here! You are now in full sync}    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -