Skip to content

Instantly share code, notes, and snippets.

@amro
Created December 14, 2011 02:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amro/1474947 to your computer and use it in GitHub Desktop.
Save amro/1474947 to your computer and use it in GitHub Desktop.
//Start at negative kWiggleAnimationAngle so we animate to positive kWiggleAnimationAngle
view.layer.transform = CATransform3DMakeRotation(-kWiggleAnimationAngle, 0, 0, 1.0);
//Setup a transform that will rotate our view to positive kWiggleAnimationAngle
CATransform3D transform = CATransform3DMakeRotation(kWiggleAnimationAngle, 0, 0, 1.0);
//Setup our animation with the transform
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
animation.toValue = [NSValue valueWithCATransform3D:transform];
animation.repeatCount = HUGE_VALF;
animation.duration = 0.1;
animation.autoreverses = YES;
[view.layer addAnimation:animation forKey:@"wiggle"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment