Note that there are some explanatory texts on larger screens.

plurals
  1. POHow come my Core Animation transformation always returns to it's start-state?
    primarykey
    data
    text
    <p>I am trying to perform some kind of animation of a layer in my iPhone application. It does not matter what I do I always get the same results: after the animation is done it jerks back into it's original position. Even though I set <code>removedOnCompletion</code> to false there is no difference.</p> <p>What am I missing here?</p> <p>Thanks in advance!</p> <p><strong>EDIT:</strong> Really need help with this one guys. I am creating animations with <code>CAKeyframeAnimation</code> and <code>CABasicAnimation</code> objects, then adding them to a <code>CAAnimationGroup</code> which I in turn att to the layer. The animation works as predicted except that it always snaps back to it's original state. This is the case even though I set <code>removedOnCompletion = NO;</code> on all animation-objects and the animation group.</p> <p>Some one please point me in the right direction! I you live in the Stockholm area I will buy you a coffe. =) New code posted below:</p> <pre><code>CABasicAnimation *leveloutLeafAnimation = [CABasicAnimation animationWithKeyPath:@"transform"]; leveloutLeafAnimation.removedOnCompletion = NO; leveloutLeafAnimation.duration = 1.0; leveloutLeafAnimation.repeatDuration = 20; CATransform3D transformLeafToRotation = CATransform3DMakeRotation(0.0, 0.0, 0.0, 1); CATransform3D transformLeafFromRotation = CATransform3DMakeRotation([self _degreesToRadians:270.0], 0.0, 0.0, 1); leveloutLeafAnimation.fromValue = [NSValue valueWithCATransform3D:transformLeafFromRotation]; leveloutLeafAnimation.toValue = [NSValue valueWithCATransform3D:transformLeafToRotation]; //Create an animation group to combine the animations. CAAnimationGroup *theAnimationGroup = [CAAnimationGroup animation]; //The animationgroup conf. theAnimationGroup.delegate = self; theAnimationGroup.duration = animationDuration; theAnimationGroup.removedOnCompletion = NO; theAnimationGroup.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; theAnimationGroup.animations = [NSArray arrayWithObjects:leveloutLeafAnimation, leafMoveAnimation, nil]; // Add the animation group to the leaf layer. [leafViewLayer addAnimation:theAnimationGroup forKey:@"animatLeafFalling"]; </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.
 

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