Last active
December 15, 2015 03:49
-
-
Save mundstein/5197489 to your computer and use it in GitHub Desktop.
View Quiviring for iOS, like in Springboard. Ideal for collection views before deleting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// INSERT CELL ANIMATION SNIPPET HERE | |
- (void)startQuivering | |
{ | |
CABasicAnimation *quiverAnim = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; | |
float startAngle = (-2) * M_PI/180.0; | |
float stopAngle = -startAngle; | |
quiverAnim.fromValue = [NSNumber numberWithFloat:startAngle]; | |
quiverAnim.toValue = [NSNumber numberWithFloat:3 * stopAngle]; | |
quiverAnim.autoreverses = YES; | |
quiverAnim.duration = 0.2; | |
quiverAnim.repeatCount = HUGE_VALF; | |
float timeOffset = (float)(arc4random() % 100)/100 - 0.50; | |
quiverAnim.timeOffset = timeOffset; | |
CALayer *layer = self.layer; | |
[layer addAnimation:quiverAnim forKey:@"quivering"]; | |
} | |
- (void)stopQuivering | |
{ | |
CALayer *layer = self.layer; | |
[layer removeAnimationForKey:@"quivering"]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment