iOS-iOS平移旋转动画通过核⼼动画实现(动画组)
有时需要对某个特定的View进⾏平移+旋转的操作,其实很简单,只需要⼀个动画组就可以解决:
一如当年#pragma mark 动画
- (void)tipAnimation:(UIView *)tipView toPoint:(CGPoint)toPoint angle:(CGFloat)angle{
//平移
CGPoint fromPoint = ;
UIBezierPath *movePath = [UIBezierPath bezierPath];
[movePath moveToPoint:fromPoint];
CGPoint newtoPoint = CGPointMake(fromPoint.x+toPoint.x , fromPoint.y+toPoint.y) ;
[movePath addLineToPoint:newtoPoint];综合鉴定材料
CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
moveAnim.path = movePath.CGPath;
无法连接到服务器
moveAnim.duration = lf.animationDuration;
moveAnim.fillMode = kCAFillModeForwards;
moveAnim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaOut];
品多//旋转
赚钱秘诀CABasicAnimation *TransformAnim = [CABasicAnimation animationWithKeyPath:@"transform"];
TransformAnim.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
//沿Z轴旋转
TransformAnim.cumulative = YES;
新年好儿歌纸的种类TransformAnim.duration =lf.animationDuration;
< = toPoint;
TransformAnim.fillMode = kCAFillModeForwards;
TransformAnim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaOut];
//动画组
CAAnimationGroup *animGroup = [CAAnimationGroup animation];
animGroup.animations = [NSArray arrayWithObjects:moveAnim, TransformAnim, nil];
animGroup.duration = lf.animationDuration;
取得进步peatCount = 1;
animGroup.fillMode = kCAFillModeForwards;
[tipView.layer addAnimation:animGroup forKey:nil];
}