iphone objective-c core-animation cgpath

iphone - ¿Es posible reproducir una ruta hacia atrás en un CAKeyFrameAnimation?



objective-c core-animation (2)

Puede que esta no sea la mejor solución, pero funcionó para mí. Le dije a la animación que pasara automáticamente, luego la comencé a la mitad. Pero para evitar que volviera a animar, tenía que terminarla antes.

- (void) animate { CAKeyframeAnimation * pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; pathAnimation.path = path; pathAnimation.duration = 15.0; pathAnimation.calculationMode = kCAAnimationPaced; pathAnimation.timeOffset = pathAnimation.duration; pathAnimation.autoreverses = YES; NSString * key = @"pathAnimation"; [animatedView.layer addAnimation:pathAnimation forKey:key]; [NSTimer scheduledTimerWithTimeInterval:pathAnimation.duration target:self selector:@selector(endAnimation:) userInfo:key repeats:NO]; } - (void) endAnimation:(NSTimer *)timer { [animatedView.layer removeAnimationForKey:timer.userInfo]; }

Si existe una mejor manera, me gustaría saber.

Quiero animar la posición de un CALayer basado en un CGPath, pero quiero jugarlo al revés.

¿Hay alguna manera de animar un camino hacia atrás, o revertir un CGPath?


animation.speed = -1;

?