Voici mon extrait de code pour l'application de cacao en utilisant l'animation de base, en quelque sorte l'animation ne s'affiche pas.L'animation ne montre pas
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];
[animation setDelegate:self];
NSRect pos = [imageView frame];
[animation setFromValue:[NSValue valueWithRect:pos]];
NSPoint point = NSMakePoint(pos.origin.x-40, pos.origin.y);
[animation setToValue:[NSValue valueWithPoint:point]];
[animation setDuration:2.0];
[[imageView animator] addAnimation:animation forKey:@"myTest"];
alors que c'est le code de travail:
NSRect position = [imageView frame];
position.origin.x -= 40;
[[imageView animator] setFrame:position];
Mais autoReverse ne fonctionne pas.
Quelque chose ne va pas avec le premier? Et comment faire fonctionner le mouvement inverse dans le 2ème? Merci!