-(void)superBilibiliCicle{
//CABasicAnimation *
CABasicAnimation* sizeTransform=[CABasicAnimationanimationWithKeyPath:@"transform"];
sizeTransform.fromValue=[NSValuevalueWithCATransform3D:CATransform3DIdentity];
sizeTransform.toValue=[NSValuevalueWithCATransform3D:CATransform3DMakeScale(10,10,1)];
CABasicAnimation* opacity=[CABasicAnimationanimationWithKeyPath:@"opacity"];
opacity.fromValue=[NSNumbernumberWithFloat:1.0];
opacity.toValue=[NSNumbernumberWithFloat:0.0];
CABasicAnimation* cicle=[CABasicAnimationanimationWithKeyPath:@"transform"];
cicle.fromValue=[NSValuevalueWithCATransform3D:CATransform3DIdentity];
cicle.toValue=[NSValuevalueWithCATransform3D:CATransform3DMakeRotation(M_PI,0,0,1)];
CAKeyframeAnimation* animation =[CAKeyframeAnimationanimationWithKeyPath:@"position"];
[animationsetValues:[NSArrayarrayWithObjects:[NSValuevalueWithCGPoint:CGPointMake(300,300)], [NSValuevalueWithCGPoint:CGPointMake(100,100)],nil]];
CAAnimationGroup* group=[CAAnimationGroupanimation];
//雖不造 但是sizeTransform 與 cicle可能互斥 不能一塊用CATransform3DMakeScale和CATransform3DMakeRotation 不能一塊用
group.animations=[NSArrayarrayWithObjects:animation,opacity,sizeTransform,nil];http://www.reibang.com/users/9e1972b6e5f7
group.duration=3;
group.repeatCount=10;
[self.blackRect.layeraddAnimation:groupforKey:nil];
}
-(void)pathMove{
CGMutablePathRefpath=CGPathCreateMutable();
CGPathMoveToPoint(path,NULL,0,100);
CGPathAddLineToPoint(path,NULL,100,100);
CGPathAddLineToPoint(path,NULL,100,0);
CGPathAddLineToPoint(path,NULL,0,0);
CAKeyframeAnimation* keyAnimation=[CAKeyframeAnimationanimationWithKeyPath:@"position"];
[keyAnimationsetPath:path];
[keyAnimationsetDuration:3.0];
[keyAnimationsetAutoreverses:YES];
[self.blackRect.layeraddAnimation:keyAnimationforKey:nil];
}
-(void)pointMove{
CAKeyframeAnimation* keyAnimation=[CAKeyframeAnimationanimationWithKeyPath:@"position"];
[keyAnimationsetValues:[NSArrayarrayWithObjects:[NSValuevalueWithCGPoint:CGPointMake(0,100)],[NSValuevalueWithCGPoint:CGPointMake(100,100)],[NSValuevalueWithCGPoint:CGPointMake(100,0)],[NSValuevalueWithCGPoint:CGPointMake(0,0)],nil]];
[keyAnimationsetDuration:3.0];
[self.blackRect.layeraddAnimation:keyAnimationforKey:nil];
}