hi iam currently working in simple amimation app in which i implement following code
CGMutablePathRef path = CGPathCreateMutable();
// CGPathMoveToPoint use to move position
CGPathMoveToPoint(path, NULL, 160, 90);
//move image to state x Axes Right
CGPathAddLineToPoint(path, NULL,-30, 90);
animation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
animation.path = path;
CFRelease(path);
animation.duration = 15.0;
animation.repeatCount = 0;
animation.rotationMode = kCAAnimationPaced;
animation.开发者_如何学PythonremovedOnCompletion = YES;
[[ballImageView1 layer] addAnimation:animation forKey:@"zposition"];
but my problem is that whenever animation is completed then anmation stop func
I'm not sure about your question. It sounds like your animation stopped and you what it to repeat indefinitely?
By setting repeatCount = 0, it will only go through the animation once.
You need to set repeatCount = HUGE_VALF to get it to repeat over an over.
repeatCount Determines the number of times the animation will repeat.
@property float repeatCount Discussion May be fractional. If the repeatCount is 0, it is ignored. Defaults to 0. If both repeatDuration and repeatCount are specified the behavior is undefined.
Setting this property to HUGE_VALF will cause the animation to repeat forever.
If you just want the last frame of the animation to stay visible then set removedOnCompletion = NO.
精彩评论