Figure 1-7 Converting a coordinate using matrix math
可见只要实现上图的矩阵,就能满足我们的要求了,如果还不清楚,这里有更详细的说明:
这里在记录下
CABasicAnimation animationWithKeyPath的参数:
opacity,position,transform.rotation.x(y,z) ,transform.scale
autoreverses = YES 这个参数将在动画播放完成后实现倒播
一个简单的例子:
- (IBAction)loginClick:(id)sender {
CABasicAnimation *fader = [CABasicAnimation animationWithKeyPath:@"opacity"];
[fader setDuration:2.0];
[fader setFromValue:[NSNumber numberWithFloat:1.0]];
[fader setToValue:[NSNumber numberWithFloat:0.0]];
fader.autoreverses = YES;
[self.view.layer addAnimation:fader forKey:@"test"];
}