Note that there are some explanatory texts on larger screens.

plurals
  1. POJerky Animation for UiView PopOut
    primarykey
    data
    text
    <p>I have a UIView for which I am using the following code for pop-in animation</p> <pre><code>float duration=1.3f; CAKeyframeAnimation *scale = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"]; scale.duration = duration; scale.values = [NSArray arrayWithObjects:[NSNumber numberWithFloat:.5f], [NSNumber numberWithFloat:1.1f], [NSNumber numberWithFloat:0.95f], [NSNumber numberWithFloat:1.f], nil]; CABasicAnimation *fadeIn = [CABasicAnimation animationWithKeyPath:@"opacity"]; fadeIn.duration = duration * .2f; fadeIn.fromValue = [NSNumber numberWithFloat:0.f]; fadeIn.toValue = [NSNumber numberWithFloat:1.f]; fadeIn.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; fadeIn.fillMode = kCAFillModeForwards; CAAnimationGroup *animationgroup = [CAAnimationGroup animation]; animationgroup.delegate=self; animationgroup.animations = [NSArray arrayWithObjects:scale, fadeIn, nil]; animationgroup.duration = duration; animationgroup.fillMode = kCAFillModeForwards; animationgroup.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; [animationgroup setValue:@"popIn" forKey:@"name"]; animationgroup.fillMode=kCAFillModeForwards; [self.view.layer addAnimation:animationgroup forKey:@"popIn"]; </code></pre> <p>That works fone. It pops In the view in perfect way. But the code of pop-out animation is gives a jerk at end of animation that looks quite wierd.</p> <p>Here is my popout code</p> <pre><code>float duration=0.15f; CAKeyframeAnimation *scale = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"]; scale.duration = duration; scale.removedOnCompletion = NO; scale.values = [NSArray arrayWithObjects:[NSNumber numberWithFloat:1.f], [NSNumber numberWithFloat:1.1f], [NSNumber numberWithFloat:.15f], nil]; CABasicAnimation *fadeOut = [CABasicAnimation animationWithKeyPath:@"opacity"]; fadeOut.duration = duration * .4f; fadeOut.fromValue = [NSNumber numberWithFloat:1.f]; fadeOut.toValue = [NSNumber numberWithFloat:0.f]; fadeOut.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; fadeOut.beginTime = duration * .6f; fadeOut.fillMode = kCAFillModeBoth; CAAnimationGroup *animationgroup = [CAAnimationGroup animation]; animationgroup.animations = [NSArray arrayWithObjects:scale, fadeOut, nil]; animationgroup.duration = duration; animationgroup.fillMode = kCAFillModeForwards; animationgroup.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; [animationgroup setValue:@"popOut" forKey:@"name"]; animationgroup.fillMode=kCAFillModeForwards; [self.view.layer addAnimation:animationgroup forKey:@"popOut"]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload