Вы можете использовать настраиваемую функцию следующим образом:
- (void)moveAndRotateLayer: (CALayer *)layer withDuration:(double)duration degreeX:(double)degreeX y:(int)degreeY angle:(float)angle autoreverseEnable:(BOOL)ar repeatTime:(int)repeat andTimingFunctionType:(NSString *)type
{
// You should type the timing function type as "Liner", "EaseIn", "EaseOut" or "EaseInOut".
// The default option is the liner timing function.
// About these functions, look in the Apple's reference documents.
CAAnimationGroup *theGroup = [CAAnimationGroup animation];
CGPoint movement = CGPointMake(layer.position.x + degreeX, layer.position.y + degreeY);
NSArray *animations = [NSArray arrayWithObjects:[self moveLayers:layer to:movement duration:duration], [self rotateLayers:layer to:angle duration:duration], nil];
theGroup.duration = duration;
theGroup.repeatCount = repeat;
theGroup.autoreverses = ar;
if ([type isEqualToString:@"EaseIn"])
{
theGroup.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseIn];
}
else if ([type isEqualToString:@"EaseOut"])
{
theGroup.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseOut];
}
else if ([type isEqualToString:@"EaseInOut"])
{
theGroup.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut];
}
else
{
theGroup.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
}
theGroup.animations = [NSArray arrayWithArray:animations];
[layer addAnimation:theGroup forKey:@"movingAndRotating"];
}
Это решение анимации только для перемещения и вращения слоя,
, но я знаю, что вы можете настроить себя.
Это очень хорошо для тебя.Вы можете сделать это.
Удачи!