0
CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
NSArray *times = [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:0.33], [NSNumber numberWithFloat:0.5], [NSNumber numberWithFloat:1.0], nil];
[anim setKeyTimes:times];
NSArray *values = [NSArray arrayWithObjects:[NSValue valueWithCGPoint: CGPointMake(100., 100.)], [NSValue valueWithCGPoint: CGPointMake(100., 200.)], [NSValue valueWithCGPoint: CGPointMake(220., 200.)], [NSValue valueWithCGPoint: CGPointMake(220., 100.)], nil];
anim.speed=1.0f;
[anim setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
[anim setValues:values];
[anim setDuration:6.0];
[sublayer addAnimation:anim forKey:@"position"];
我能夠在CALayer跳回到原始位置後,讓CALayer在路徑上進行動畫處理。有什麼辦法可以防止這種情況發生?任何幫助表示讚賞。使卡拉萊不會移動到原始位置