-
StackOverflow 文件
-
iOS 教程
-
CAShapeLayer
-
CAShapeLayer 動畫
CAShapeLayer *circle = [CAShapeLayer layer];
[circle setPath:[[UIBezierPath bezierPathWithOvalInRect:CGRectMake(100, 100, 150, 150)] CGPath]];
[circle setStrokeColor:[[UIColor blueColor] CGColor]];
[circle setFillColor:[[UIColor clearColor] CGColor]];
[[self.view layer] addSublayer:circle];
CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
pathAnimation.duration = 1.5f;
pathAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
pathAnimation.toValue = [NSNumber numberWithFloat:1.0f];
pathAnimation.repeatCount = 10;
pathAnimation.autoreverses = YES;
[circle addAnimation:pathAnimation
forKey:@"strokeEnd"];
http://i.stack.imgur.com/jzSkM.gif