如何在ios中运用core animation暂停和继续动画
2个回答
2016-03-29 · 百度知道合伙人官方认证企业
育知同创教育
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注
展开全部
如何在ios中运用core
animation暂停和继续动画
核心代码如下
//暂停layer上面的动画
-
(void)pauseLayer:(CALayer*)layer
{
CFTimeInterval pausedTime = [layer
convertTime:CACurrentMediaTime() fromLayer:nil];
layer.speed = 0.0;
layer.timeOffset = pausedTime;
}
//继续layer上面的动画
-
(void)resumeLayer:(CALayer*)layer
{
CFTimeInterval pausedTime = [layer
timeOffset];
layer.speed = 1.0;
layer.timeOffset = 0.0;
layer.beginTime = 0.0;
CFTimeInterval timeSincePause = [layer
convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime;
layer.beginTime = timeSincePause;
}
分享
animation暂停和继续动画
核心代码如下
//暂停layer上面的动画
-
(void)pauseLayer:(CALayer*)layer
{
CFTimeInterval pausedTime = [layer
convertTime:CACurrentMediaTime() fromLayer:nil];
layer.speed = 0.0;
layer.timeOffset = pausedTime;
}
//继续layer上面的动画
-
(void)resumeLayer:(CALayer*)layer
{
CFTimeInterval pausedTime = [layer
timeOffset];
layer.speed = 1.0;
layer.timeOffset = 0.0;
layer.beginTime = 0.0;
CFTimeInterval timeSincePause = [layer
convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime;
layer.beginTime = timeSincePause;
}
分享
2016-04-02 · 做真实的自己 用良心做教育
千锋教育
千锋教育专注HTML5大前端、JavaEE、Python、人工智能、UI&UE、云计算、全栈软件测试、大数据、物联网+嵌入式、Unity游戏开发、网络安全、互联网营销、Go语言等培训教育。
向TA提问
关注
展开全部
核心代码如下
//暂停layer上面的动画
-
(void)pauseLayer:(CALayer*)layer
{
CFTimeInterval pausedTime = [layer
convertTime:CACurrentMediaTime() fromLayer:nil];
layer.speed = 0.0;
layer.timeOffset = pausedTime;
}
//继续layer上面的动画
-
(void)resumeLayer:(CALayer*)layer
{
CFTimeInterval pausedTime = [layer
timeOffset];
layer.speed = 1.0;
layer.timeOffset = 0.0;
layer.beginTime = 0.0;
CFTimeInterval timeSincePause = [layer
convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime;
layer.beginTime = timeSincePause;
}
//暂停layer上面的动画
-
(void)pauseLayer:(CALayer*)layer
{
CFTimeInterval pausedTime = [layer
convertTime:CACurrentMediaTime() fromLayer:nil];
layer.speed = 0.0;
layer.timeOffset = pausedTime;
}
//继续layer上面的动画
-
(void)resumeLayer:(CALayer*)layer
{
CFTimeInterval pausedTime = [layer
timeOffset];
layer.speed = 1.0;
layer.timeOffset = 0.0;
layer.beginTime = 0.0;
CFTimeInterval timeSincePause = [layer
convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime;
layer.beginTime = timeSincePause;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询