[英]Rotating animation
我正在將箭頭旋轉45度。 動畫結束時,箭頭將返回其原始狀態(0度)。 我需要箭頭不回到原始狀態,並且在動畫結束時將其旋轉45度。
CABasicAnimation *fullRotationShort = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
fullRotationShort.fromValue = [NSNumber numberWithFloat:0];
fullRotationShort.toValue = [NSNumber numberWithFloat:M_PI/28*4.7];
fullRotationShort.duration = 1.0f;
fullRotationShort.repeatCount = 1;
[imgViewArrowShort.layer addAnimation:fullRotationShort forKey:nil];
假設您的箭頭是一個名為arrow
的UIImageView
。
您真的不需要這樣復雜的CAAnimations。
[UIView animateWithDuration:1.0 animations:^{
arrow.transform = CGAffineTransformMakeRotation(0.25 * M_PI);
}];
設置屬性:
fullRotationShort.fillMode = kCAFillModeForwards;
fullRotationShort.cumulative = YES;
fullRotationShort.removedOnCompletion=NO;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.