我正在使用以下CABasicAnimation。但是,它非常緩慢..有沒有辦法加速它?謝謝。如何加快CABasicAnimation?
- (void)spinLayer:(CALayer *)inLayer duration:(CFTimeInterval)inDuration
direction:(int)direction
{
CABasicAnimation* rotationAnimation;
// Rotate about the z axis
rotationAnimation =
[CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
// Rotate 360 degress, in direction specified
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 * direction];
// Perform the rotation over this many seconds
rotationAnimation.duration = inDuration;
// Set the pacing of the animation
rotationAnimation.timingFunction =
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
// Add animation to the layer and make it so
[inLayer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
}
你有沒有試過給它一個較小的持續時間?或者你想知道幀率? –
@Yann:謝謝你的工作。但是,如果我想要更長的持續時間,我該怎麼做?我現在用了10秒,但是我需要80秒左右的動畫....有什麼幫助嗎? – Ahsan
然後給它80秒的持續時間...... –