1.动画旋转:
[UIViewbeginAnimations:@"View Flip"context:nil]; //声明,@"XX"为标题,
[UIViewsetAnimationDuration:1.25]; //持续时间
[UIViewsetAnimationCurve:UIViewAnimationCurveEaseInOut]; //设置动画曲线
//加入新的坐标 //旋转视图
[UIViewsetAnimationTransition:UIViewAnimationTransitionFlipFromRight
forView:self.viewcache:YES]; ///调用
2.左右晃动动画:
// start the wiggling animation
CGFloatrotation =0.03; CABasicAnimation*shake = [CABasicAnimation animationWithKeyPath:@"transform"];
shake.duration = 0.13;
shake.autoreverses = YES;
shake.repeatCount = MAXFLOAT;
shake.removedOnCompletion = NO;
shake.fromValue = [NSValue valueWithCATransform3D:CATransform3DRotate(self.layer.transform,-rotation, 0.0 ,0.0 ,1.0)];
shake.toValue = [NSValue valueWithCATransform3D:CATransform3DRotate(self.layer.transform, rotation, 0.0 ,0.0 ,1.0)]; [self.layeraddAnimation:shake forKey:@"shakeAnimation"]; //然后在退出的时候移除
[self.layer removeAnimationForKey:@"shakeAnimation"];
3、
CATransform3D transformBefore = CATransform3DIdentity;
transformBefore.m34 = 0.0005;
transformBefore = CATransform3DRotate(transformBefore,(M_PI/*), , , );
instroduceLayer.layer.transform = transformBefore;
instroduceLayer.layer.anchorPoint = CGPointMake(0.0, 0.5); [UIViewanimateWithDuration:1animations:^{
CATransform3D transform = CATransform3DIdentity;//单位矩阵
transform.m34 = 0.0005;
transform = CATransform3DRotate(transform,(M_PI/*), , , );
instroduceLayer.layer.transform = transform;
}];