Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect the completion of Animation

So,

I perform a simple animation with CABasicAnimation (as shown below).

CAAnimationGroup *theGroup = [CAAnimationGroup animation];
theGroup.fillMode = kCAFillModeForwards;
theGroup.removedOnCompletion = NO;
theGroup.delegate = self;
theGroup.timingFunction =[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];

theGroup.duration = inDuration;
theGroup.repeatCount = 0;
theGroup.animations = [NSArray arrayWithObjects:rotationZ, theAnimationX, theAnimationY, nil]; // you can add more

[inLayer addAnimation:theGroup forKey:@"animateLayer"];

NSLog (@"ABCD");
// This gets called before end of animation

Is there any method like -(BOOL) isAnimationCompleted; so that I could know when animation is completed ?

I want to run a method right after animation has come to a complete end . Any ideas ?

like image 413
Legolas Avatar asked Dec 28 '11 11:12

Legolas


People also ask

What is Animationend in Javascript?

The animationend event is fired when a CSS Animation has completed. If the animation aborts before reaching completion, such as if the element is removed from the DOM or the animation is removed from the element, the animationend event is not fired.

What is animation-iteration-count?

The animation-iteration-count CSS property sets the number of times an animation sequence should be played before stopping.

What is animation-iteration-count infinite?

infinite. If assigned an animation-iteration-count value of infinite, the animation will repeat infinitely. This is the best value for an animation that you don't want stopping on its own.


1 Answers

Implement the method

- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag

which you can see the doc from here.

like image 55
Ilanchezhian Avatar answered Oct 10 '22 03:10

Ilanchezhian