本文共 2253 字,大约阅读时间需要 7 分钟。
// Create basic animation to rotate around the Y and Z axes
// CABasicAnimation *transformAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
// transformAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
// transformAnimation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(DEGREES_TO_RADIANS(0), 0, 1, 1)];
// transformAnimation.duration = 1.5;
// transformAnimation.autoreverses = YES;//栅格化图层
// transformAnimation.repeatCount = HUGE_VALF;
// transformAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
CABasicAnimation *translateAnimation = [CABasicAnimationanimationWithKeyPath:@"transform.translation.x"];
translateAnimation.fromValue = [NSValuevalueWithCATransform3D:layer.transform];
translateAnimation.toValue = [NSNumbernumberWithFloat:tx];
translateAnimation.duration =1.5;
translateAnimation.autoreverses =YES;
translateAnimation.timingFunction = [CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseInEaseOut];
translateAnimation.repeatCount =HUGE_VALF;
[layer addAnimation:translateAnimationforKey:nil];
转载地址:http://bjosi.baihongyu.com/