Created
June 24, 2013 16:28
-
-
Save briandw/5851387 to your computer and use it in GitHub Desktop.
rantlab 1.4
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
- (void)wiggleFromPath:(CGPathRef)path target:(CGPoint)target amount:(CGFloat)amount | |
{ | |
CGPoint middle = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); | |
CGPathRef endPath = [RLArrowView createPathWithArrowFromPoint:middle | |
toPoint:target | |
tailWidth:2.0 | |
headWidth:10.0 | |
headLength:20.0 | |
wiggle:amount]; | |
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){ | |
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"path"]; | |
animation.duration = 0.1; | |
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
animation.repeatCount = 0; | |
animation.autoreverses = NO; | |
animation.fromValue = (__bridge id)path; | |
animation.toValue = (__bridge id)endPath; | |
[arrow addAnimation:animation forKey:@"animatePath"]; | |
arrow.path = endPath; | |
} completionHandler:^{ | |
if (fabs(amount)>0.02) [self wiggleFromPath:endPath target:target amount:amount*-0.7]; | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment