iOS-iOS平移旋转动画通过核心动画实现(动画组)

更新时间:2023-06-17 15:08:27 阅读: 评论:0

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];
}

本文发布于:2023-06-17 15:08:27,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/976376.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:动画   旋转   平移
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图