Type Method

addKeyframeWithRelativeStartTime:relativeDuration:animations:

Specifies the timing and animation values for a single frame of a keyframe animation.

Declaration

+ (void)addKeyframeWithRelativeStartTime:(double)frameStartTime relativeDuration:(double)frameDuration animations:(void (^)(void))animations;

Parameters

frameStartTime

The time at which to start the specified animations. This value must be in the range 0 to 1, where 0 represents the start of the overall animation and 1 represents the end of the overall animation. For example, for an animation that is two seconds in duration, specifying a start time of 0.5 causes the animations to begin executing one second after the start of the overall animation.

frameDuration

The length of time over which to animate to the specified value. This value must be in the range 0 to 1 and indicates the amount of time relative to the overall animation length. If you specify a value of 0, any properties you set in the animations block update immediately at the specified start time. If you specify a nonzero value, the properties animate over that amount of time. For example, for an animation that is two seconds in duration, specifying a duration of 0.5 results in an animation duration of one second.

animations

A block object containing the animations you want to perform. This is where you programmatically change any animatable properties of the views in your view hierarchy. This block takes no parameters and has no return value. This parameter must not be nil.

Discussion

To animate view properties during a keyframe animation, call this method from within the animation block you pass to the animateKeyframesWithDuration:delay:options:animations:completion: method. To animate between different values, or to tweak the timing of your view property animations, you can call this method multiple times within a block.

The view properties you change in the animations block animate over the timespan you specify in frameDuration parameter. The properties do not begin animating until the time you specify in the frameStartTime parameter. After the frame start time, the animation executes over its specified duration or until interrupted by another animation.

See Also

Animating Views with Block Objects

+ animateWithDuration:delay:options:animations:completion:

Animate changes to one or more views using the specified duration, delay, options, and completion handler.

+ animateWithDuration:animations:completion:

Animate changes to one or more views using the specified duration and completion handler.

+ animateWithDuration:animations:

Animate changes to one or more views using the specified duration.

+ transitionWithView:duration:options:animations:completion:

Creates a transition animation for the specified container view.

+ transitionFromView:toView:duration:options:completion:

Creates a transition animation between the specified views using the given parameters.

+ animateKeyframesWithDuration:delay:options:animations:completion:

Creates an animation block object that can be used to set up keyframe-based animations for the current view.

+ performSystemAnimation:onViews:options:animations:completion:

Performs a specified system-provided animation on one or more views, along with optional parallel animations that you define.

+ animateWithDuration:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:completion:

Performs a view animation using a timing curve corresponding to the motion of a physical spring.

+ performWithoutAnimation:

Disables a view transition animation.