【发布时间】:2024-01-20 00:17:01
【问题描述】:
我正在尝试为录像机上的红点设置动画。我希望点突然出现和消失,每 0.7 秒。我尝试的每个动画选项都有点以某种方式缓入或缓出。我怎样才能让它完全出现并完全消失?看起来 UIViewAnimationOptionTransitionNone 默认值与 UIView.h 中的 UIViewAnimationOptionCurveEaseInOut 相同。如何在没有任何缓动的情况下制作动画?
enum {
UIViewAnimationOptionLayoutSubviews = 1 << 0,
UIViewAnimationOptionAllowUserInteraction = 1 << 1,
UIViewAnimationOptionBeginFromCurrentState = 1 << 2,
UIViewAnimationOptionRepeat = 1 << 3,
UIViewAnimationOptionAutoreverse = 1 << 4,
UIViewAnimationOptionOverrideInheritedDuration = 1 << 5,
UIViewAnimationOptionOverrideInheritedCurve = 1 << 6,
UIViewAnimationOptionAllowAnimatedContent = 1 << 7,
UIViewAnimationOptionShowHideTransitionViews = 1 << 8,
UIViewAnimationOptionOverrideInheritedOptions = 1 << 9,
UIViewAnimationOptionCurveEaseInOut = 0 << 16,
UIViewAnimationOptionCurveEaseIn = 1 << 16,
UIViewAnimationOptionCurveEaseOut = 2 << 16,
UIViewAnimationOptionCurveLinear = 3 << 16,
UIViewAnimationOptionTransitionNone = 0 << 20,
UIViewAnimationOptionTransitionFlipFromLeft = 1 << 20,
UIViewAnimationOptionTransitionFlipFromRight = 2 << 20,
UIViewAnimationOptionTransitionCurlUp = 3 << 20,
UIViewAnimationOptionTransitionCurlDown = 4 << 20,
UIViewAnimationOptionTransitionCrossDissolve = 5 << 20,
UIViewAnimationOptionTransitionFlipFromTop = 6 << 20,
UIViewAnimationOptionTransitionFlipFromBottom = 7 << 20,
};
现在是我的代码,
[UIView animateWithDuration:0.7
delay:0
options:(UIViewAnimationOptionRepeat | UIViewAnimationOptionTransitionNone)
animations:^(void){
self.recordingAnimationImage.alpha=0.0;
}
completion:nil
];
【问题讨论】:
标签: ios objective-c animation uiview