Animation

public struct Animation

Statics methods for CAAnimation

  • Animation by changing the opacity

    Declaration

    Swift

    public static func opacity(from fromValue: CGFloat, to toValue: CGFloat) -> CABasicAnimation

    Parameters

    fromValue

    the initial value of the animation

    toValue

    the final value of the animation

    Return Value

    a CABasicAnimation object

  • Animation by changing the scale using transform

    Declaration

    Swift

    public static func transform(from fromValue: CGFloat = 1.0, to toValue: CGFloat) -> CABasicAnimation

    Parameters

    fromValue

    the initial value of the animation

    toValue

    the final value o the animation

    Return Value

    a CABasicAnimation object

  • Animation by changing the color

    Declaration

    Swift

    public static func color(from fromColor: CGColor, to toColor: CGColor) -> CABasicAnimation

    Parameters

    fromColor

    the initial color of the animation

    toColor

    the final color of the animation

    Return Value

    a CABasicAnimation

  • Animation by changing the scale using transform

    Declaration

    Swift

    public static func transform(times: [NSNumber] = [0.0, 0.5, 1.0], values: [CGFloat] = [0.0, 1.4, 1.0], duration: CFTimeInterval = 0.3) -> CAKeyframeAnimation

    Parameters

    times

    An array of NSNumber objects that define the time at which to apply a given keyframe segment.

    values

    An array of objects that specify the keyframe values to use for the animation.

    duration

    the duration of the animation, the default value is 0.3

    Return Value

    a CAKeyframeAnimation object

  • Animation to hide views, using transform and changing the scale to 0.0

    Declaration

    Swift

    public static func hide() -> CAKeyframeAnimation

    Return Value

    a CAKeyframeAnimation object

  • Allows multiple animations to be grouped and run concurrently.

    Declaration

    Swift

    public static func group(animations: CAAnimation..., duration: CFTimeInterval) -> CAAnimationGroup

    Parameters

    animations

    the list of animations

    duration

    the animation duration

    Return Value

    a CAAnimationGroup object