2013-01-02 31 views
1

嗨,我正在开发一个应用程序需要图像动画之间的两个angles.ie从0-90,然后90-0度图像达到0度后,动画必须停止。旋转(固定端)一个imageView与两个角度之间的动画

我使用下面的代码是从0-90只给动画,也是我需要将图像与动画从90

   [UIView animateWithDuration: 0.5f 
        delay: 0.0f 
        options: options 
       animations: ^{ 
        self.imageToMove.transform = CGAffineTransformRotate(imageToMove.transform, M_PI/2); 
       } 
       completion: ^(BOOL finished) { 
        if (finished) { 
         // if flag still set, keep spinning with constant speed 
         [self spinWithOptions: UIViewAnimationOptionCurveLinear]; 
         } 
        } 
       }]; 

任何帮助,请到达0 ....

回答

1

由量变到质变 “RADIANS”

#define RADIANS(degrees) ((degrees * M_PI)/180.0) 

//- (void)startWobble 

-(IBAction)start:(id)sender 

{ 

    itemView.transform = CGAffineTransformRotate(CGAffineTransformIdentity, RADIANS(-1)); 

    [UIView animateWithDuration:0.15 delay:0.0 options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse) 

        animations:^ { 

         itemView.transform = CGAffineTransformRotate(CGAffineTransformIdentity, RADIANS(1)); 

        } 

        completion:NULL 

    ]; 

} 

//- (void)stopWobble 

-(IBAction)end:(id)sender 

{ 

    [UIView animateWithDuration:0.25 

          delay:0.0 

         options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveLinear) 

        animations:^ { 

         itemView.transform = CGAffineTransformIdentity; 

        } 

        completion:NULL 

    ]; 

} 
+0

很好的例子,加1的值试试这个 – JSA986

相关问题