如何通过使用CFTimeInterval为动画指定beginTime? [英] How to specify an beginTime for an animation by using CFTimeInterval?

查看:76
本文介绍了如何通过使用CFTimeInterval为动画指定beginTime?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我了解,beginTime可以用来表示嘿,从正好12:00开始。但是我如何用CFTimeInterval类型告诉这个呢?我以为这只是指定秒数的一种浮点值。

For my understanding, beginTime can be used to say "hey, start at exactly 12:00 'o clock". But how would I tell this with an CFTimeInterval type? I thought that this one is nothing more than a kind of "float" value to specify seconds.

否则指定的timeOffset属性的区别是什么在CAMediaTiming协议中?

Or what else would be then the difference to the timeOffset property that is specified in CAMediaTiming protocol?

推荐答案

我在文档中错过的内容:beginTime在核心动画绝对时间中,因此您必须获取当前时间并从中指定偏移量:

What I missed in the docs: beginTime is in "core animation absolute time" so you've to get the current time and specify your offset from that:

// Start in 5 seconds
theAnimation.beginTime = CACurrentMediaTime() + 5;

这篇关于如何通过使用CFTimeInterval为动画指定beginTime?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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