通过UIBezierPath移动CALayer [英] Move CALayer via UIBezierPath

查看:250
本文介绍了通过UIBezierPath移动CALayer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个图层将从UIBezierPath上的A点移动到B点。
我发现了很多样本​​,这些是指CAAnimation和UIBezierPath。
但是我需要在bezier路径上将我的图层从指定点移动到另一个点。

I have a layer that will move from point A to point B on a UIBezierPath. I have found a lot of samples those are refers to CAAnimation and UIBezierPath. But I need to move my layer only from specified point to another on bezier path.

>

任何建议将不胜感激。

Any suggestions would be appreciated.

感谢

推荐答案

>

Hope this will be helpful.

UIBezierPath *trackPath = [UIBezierPath bezierPath];
.
.
.
CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
anim.path = trackPath.CGPath;
anim.repeatCount = 1;
anim.duration = 2.0;
[layerToAnimate addAnimation:anim forKey:@"pathGuide"];

这篇关于通过UIBezierPath移动CALayer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆