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