structure Field | description |
transform.rotation.x | 角度,x轴( [NSNumber numberWithFloat:1.0]; ) |
transform.rotation.y | 角度,y轴() |
transform.rotation.z | 角度,z轴 |
transform.rotation |
角度 |
scale.x | 范围,x轴 |
scale.y | 范围,y轴 |
scale.z |
范围,z轴 |
scale | 范围 |
position.x | x轴的位置 |
position.y | y轴的位置 |
position.z | z轴的位置 |
position | 位置([NSValue valueWithCGPoint:groupLayer.position] ) |
//演员初始化
CALayer* groupLayer = [[CALayeralloc]init];
groupLayer.frame = CGRectMake(60, 340+100+kYOffset,50,50);
groupLayer.cornerRadius = 10;
groupLayer.backgroundColor = [UIColorcolorWithPatternImage:[UIImageimageNamed:@"heart.png"]].CGColor;
[self.view.layeraddSublayer:groupLayer];
//设定剧本
CABasicAnimation* moveAnimation =
[CABasicAnimationanimationWithKeyPath:@"position.x"];
moveAnimation.fromValue = [NSNumbernumberWithFloat:groupLayer.position.x];
moveAnimation.toValue = [NSNumbernumberWithFloat:300];
moveAnimation.autoreverses = YES;
moveAnimation.repeatCount =MAXFLOAT;
moveAnimation.duration = 2;
/*
CABasicAnimation* moveAnimation = [CABasicAnimation animationWithKeyPath:@"position"];
moveAnimation.fromValue = [NSValue valueWithCGPoint:groupLayer.position];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(320-80, groupLayer.position.y)];
moveAnimation.autoreverses = YES;
moveAnimation.repeatCount =MAXFLOAT;
moveAnimation.duration = 2;
[groupLayer addAnimation:moveAnimation forKey:@"scaleAnimation"];
*/
//开演
[groupLayer addAnimation:moveAnimation forKey:@"scaleAnimation"];