簡體   English   中英

如何做UIView不間斷翻轉動畫

[英]How to do UIView nonstop flip animation

我想獲得一個UIView圍繞Y軸進行360度旋轉而不停止的效果。

將以下代碼放入您的視圖控制器中:

CATransform3D t3d = CATransform3DIdentity;
// m34 sets the amount of perspective
t3d.m34 = 1.0/-1000.0;

[UIView animateWithDuration:1.0 
                      delay:0.0 
                    options:UIViewAnimationCurveLinear 
                 animations:^{
                     self.view.layer.transform = CATransform3DRotate(t3d, M_PI, 0, 1, 0);
                 } 
                 completion:^(BOOL finished) {
                     [UIView animateWithDuration:1.0 
                                           delay:0.0 
                                         options:UIViewAnimationCurveLinear 
                                      animations:^{
                                          self.view.layer.transform = CATransform3DRotate(t3d, 2*M_PI, 0, 1, 0);
                                      } 
                                      completion:^(BOOL finished) {
                                          self.view.layer.transform = CATransform3DIdentity;
                                      }];
                 }];

這很混亂,如果有人對如何解決此問題有任何建議,請告訴我;)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM