Created
July 15, 2015 05:23
-
-
Save coryalder/9346e476337bf051c157 to your computer and use it in GitHub Desktop.
This file contains 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
-(void)viewDidAppear:(BOOL)animated { | |
UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:(CGRect){-50,-50,100,100}]; | |
// 0, 0 is center | |
CAShapeLayer *shapeLayer = [[CAShapeLayer alloc] init]; | |
shapeLayer.path = path.CGPath; | |
shapeLayer.fillColor = [UIColor orangeColor].CGColor; | |
shapeLayer.position = self.view.center; | |
[self.view.layer addSublayer:shapeLayer]; | |
CAKeyframeAnimation *shakeyShakey = [CAKeyframeAnimation animation]; | |
shakeyShakey.keyPath = @"position.x"; | |
shakeyShakey.values = @[ @0, @10, @-10, @10, @0 ]; | |
shakeyShakey.keyTimes = @[ @0, @(2/5.0), @(3/5.0), @(4/5.0), @1 ]; | |
shakeyShakey.duration = 0.4; | |
shakeyShakey.repeatCount = 10; | |
[shakeyShakey setValue:@"shakeyShakey" forKey:@"name"]; | |
shakeyShakey.delegate = self; | |
shakeyShakey.additive = YES; | |
[shapeLayer addAnimation:shakeyShakey forKey:@"passwordShake"]; | |
} | |
-(void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag { | |
NSLog(@"stopped %@", [anim valueForKey:@"name"]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment