0
我發現這個代碼片段:爲什麼我應該在動畫中使用CATransaction?
[self setValue:direction forKey:@"currentDirection"];
CAKeyframeAnimation * animation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
animation.path = path;
animation.duration = grids * gridWidth/[self speed];
animation.fillMode = kCAFillModeForwards;
animation.removedOnCompletion = NO;
animation.delegate = self;
animation.calculationMode = kCAAnimationLinear;
[self addAnimation:animation forKey:@"movement"];
self.position = destination;
[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat:_turn_duration]
forKey:kCATransactionAnimationDuration];
eyes.position = eyeDestination;
pupils.position = pupilDestination;
[CATransaction commit];
CGPathRelease(path);
這裏有什麼用CATransaction點?
所以CAKeyframeAnimation是一個動畫塊? – Thanks 2009-07-21 22:45:12