Friday, 24 February 2012

Wenggling and vibrations of any object + iphone

- (void)startWobble {
    resultImage.transform = CGAffineTransformRotate(CGAffineTransformIdentity, RADIANS(-5));
   
    [UIView animateWithDuration:0.25
                          delay:0.0
                        options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse)
                     animations:^ {
                         resultImage.transform = CGAffineTransformRotate(CGAffineTransformIdentity, RADIANS(5));
                     }
                     completion:NULL
     ];

}
[self startWobble];
- (void)stopWobble {
 [UIView animateWithDuration:0.25
      delay:0.0
      options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveLinear)
      animations:^ {
       itemView.transform = CGAffineTransformIdentity;
      }
      completion:NULL
  ];
}
//For the shake/vibration of unbutton
https://github.com/jonasschnelli/UIView-I7ShakeAnimation

 

No comments:

Post a Comment