gpt4 book ai didi

iphone - UIViewAnimationOptionRepeat在两个动画之间暂停

转载 作者:行者123 更新时间:2023-12-01 17:57:28 25 4
gpt4 key购买 nike

我想要实现连续脉冲效果,就像在ECG(心跳监视器)中一样。目前,我正在使用两个动画块。

[UIView animateWithDuration: 2.0f delay: 0.0f options: UIViewAnimationOptionRepeat  | UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionTransitionNone | UIViewAnimationOptionOverrideInheritedDuration
animations:^{ [image1 setFrame:CGRectMake(0,200,320,70)];}
completion:^(BOOL finished){[image1 setFrame:CGRectMake(-320,200,320,70)];}];

[UIView animateWithDuration:2.0f delay:0.0f options:UIViewAnimationOptionRepeat | UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionTransitionNone | UIViewAnimationOptionOverrideInheritedDuration
animations:^{ [image2 setFrame:CGRectMake(320,200,320,70)];}
completion:^(BOOL finished){[image2 setFrame:CGRectMake(0,200,320,70)];}];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];

[UIView commitAnimations];

此动画在完成后会重复执行,但是需要稍稍停顿才能再次凝视。.我想消除之间的停顿,以实现连续而流畅的动画。

任何帮助将不胜感激。

提前致谢..

就是这样,您知道我也尝试过UIViewAnimationCurveEaseInOut ..但它仍然暂停。

最佳答案

最终我发现了...我使用下面的代码来实现流畅且不间断的动画。

[UIView animateWithDuration:2.5f delay:0.0f options:UIViewAnimationOptionRepeat | UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionCurveLinear
animations:^{ [image1 setFrame:CGRectMake(0,200,320,70)];}
completion:^(BOOL finished){}];

[UIView animateWithDuration:2.5f delay:0.0f options:UIViewAnimationOptionRepeat | UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionCurveLinear
animations:^{ [image2 setFrame:CGRectMake(320,200,320,70)];}
completion:^(BOOL finished){}];

重要的更改是我不得不将 UIViewAnimationCurveLinear 替换为 UIViewAnimationOptionCurveLinear

关于iphone - UIViewAnimationOptionRepeat在两个动画之间暂停,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14705450/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com