How to specify an beginTime for an animation by using CFTimeInterval?

Thanks picture Thanks · Jul 22, 2009 · Viewed 17.5k times · Source

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.

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

Answer

Ortwin Gentz picture Ortwin Gentz · Nov 12, 2010

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;