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

How to specify an beginTime for an animation by using 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.

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

declaring global variables in iPhone project


Where's the difference between setObject:forKey: and setValue:forKey: in NSMutableDictionary?
What I missed in the docs: beginTime is in "core animation complete time" so you've to receive the current time and specify your offset from that:. Why is my UIImageView blurred?
// Start in 5 seconds theAnimation.beginTime = CACurrentMediaTime()+5; 
SHowing Activity Indicator View Using Thread Shows This Error in gdb?Unable to push notifications to iPhone in .NET - .PEM certificate problem?


What's the difference between using obj-c accessors and using dot syntax?
I think the documentation of CAMediaTiming Protocol is very bad. UIWebView scrollBy replacementTime Warp in Animation is a thorough explanation(re-documentation) of all properties of CAMediaTiming Protocol.. Hide the tab bar when displaying the ABPeoplePickerNavigationController?


No, this is not what beginTime does. It specifies a relative start time from its parent animation (by default multiple animations in a group all fire at once).. From the documentation:.
Specifies the begin time of the receiver in relation to its parent object, if applicable..
timeOffset causes it to start animating at the frame it would be at at the offSet time, and when it reaches the end it loops around. In another words, imagine A,B,C,D,E are frames of animation this is what happends in various cases if you set beginTime or timeOffset to a value equal to when you hit frame C in the normal case..
Normal      |A->B->C->D->E beginTime:  |      A->B->C->D->E timeOffset: |C->D->E->A->B 


You first need to convert to the layer's timespace like so:.
let currentLayerTime = myLayer.convertTime(CACurrentMediaTime(), fromLayer: nil) 
Then you must set the beginTime relative to the layer's now time. For instance, to make an animation begin in 2s:.
myAnimation.beginTime = currentLayerTime + 2 
You'll also likely want to set the 'fillMode' to backwards, so this you must set the final property value before you add the animation:.
myAnimation.fillMode = kCAFillModeBackwards myLayer.any Property = any FinalValue myLayer.addAnimation(myAnimation, forKey: "myAnimationName") 

60 out of 100 based on 25 user ratings 500 reviews