如何在iOS中永远重复动画?

如何在iOS中永远重复动画?,第1张

概述参见英文答案 > How to make UIView animation sequence repeat and autoreverse                                    3个 我想在我看来永远重复一个动画.以下是我的代码: [UIView animateWithDuration:0.5f delay:0.49f options 参见英文答案 > How to make UIView animation sequence repeat and autoreverse                                    3个
我想在我看来永远重复一个动画.以下是我的代码:

[UIVIEw animateWithDuration:0.5f        delay:0.49f        options:UIVIEwAnimationoptionCurveEaseInOut        animations:^{        //for IMMERSE        [_pic2 setAlpha:1.0f];         _vIEw1_immerse=_pic2.frame;         _vIEw1_immerse.origin.x = ([UIScreen mainScreen].bounds.size.wIDth-_vIEw1_immerse.size.wIDth)/2;         self.pic2.frame=_vIEw1_immerse;         }         completion:^(BOol finished){         [UIVIEw animateWithDuration:0.5f delay:0.49f options:UIVIEwAnimationoptionCurveEaSEOut animations:^{         _vIEw1_immerse=_pic2.frame;         _vIEw1_immerse.origin.x = [UIScreen mainScreen].bounds.size.wIDth;         self.pic2.frame=_vIEw1_immerse;         [_pic2 setAlpha:0.0];         } completion:^(BOol finished){         [UIVIEw animateWithDuration:0.0f animations:^{         _vIEw1_immerse=_pic2.frame;         _vIEw1_immerse.origin.x = -_vIEw1_immerse.size.wIDth;         self.pic2.frame=_vIEw1_immerse;                                     }];                                 }];                             }];

我尝试添加选项UIVIEwAnimationoptionRepeat,但它似乎只重复最外层的“动画”部分.我想重复一整套动画.

而且我不想使用NSTimer.
谁能给我一些关于我的问题的建议?提前致谢!

解决方法 您可以查看以下代码以重复动画.

[UIVIEw animateWithDuration:1.0f                  delay:0.0f                options: UIVIEwAnimationoptionRepeat | UIVIEwAnimationoptionautoreverse | UIVIEwAnimationoptionBeginFromCurrentState             animations: ^(voID){self.vIEw.center = CGPointMake(0,200);}             completion:NulL];

谢谢

斯威夫特4

UIVIEw.animate(withDuration: 100,delay: 0,options: [.repeat,.autoreverse,.beginFromCurrentState],animations: {    },completion: nil)
总结

以上是内存溢出为你收集整理的如何在iOS中永远重复动画?全部内容,希望文章能够帮你解决如何在iOS中永远重复动画?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1005087.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-22
下一篇2022-05-22

发表评论

登录后才能评论

评论列表(0条)

    保存