Hi All,
I meet one problem while I implement my first game using CABasicAnimation.
I want following sequence..
(1) do animation (rotation)
(2) wait(sleep) 2 sec.
But, When I run below source.. It works like following sequence
(1) wait(sleep) 2sec.
(2) do animation (rotation)
Plesase refer to my source..
I meet one problem while I implement my first game using CABasicAnimation.
I want following sequence..
(1) do animation (rotation)
(2) wait(sleep) 2 sec.
But, When I run below source.. It works like following sequence
(1) wait(sleep) 2sec.
(2) do animation (rotation)
Plesase refer to my source..
Code:
// create rotation animation around z axis
CABasicAnimation *rotateAnimation = [CABasicAnimation animation];
rotateAnimation.keyPath = @"transform.rotation.z";
rotateAnimation.fromValue = [NSNumber numberWithFloat:DegreesToRadians(signValue * -kDisplacementAngle)];
rotateAnimation.toValue = [NSNumber numberWithFloat:DegreesToRadians(signValue * kDisplacementAngle)];
rotateAnimation.duration = (self.duration);
rotateAnimation.removedOnCompletion = NO;
// leaves presentation layer in final state; preventing snap-back to original state
rotateAnimation.fillMode = kCAFillModeBoth;
rotateAnimation.repeatCount = 0;
rotateAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
// add the animation to the selection layer. This causes it to begin animating.
[metronomeArm.layer addAnimation:rotateAnimation forKey:@"rotateAnimation"];
sleep(2);