EaseFunction

public enum EaseFunction

An easing function that determines the path used to get from point A to point B by calculating the position given a specific point in time.

These easing functions are based upon Robert Penner’s Easing Functions. A visualized cheat-sheet of these functions can be found at easings.net.


The aspect of time is crucial to motion — things change over time. Nothing can move in “zero time”, or be in two places at once. In other words, a position needs time to change, and it can have only one value at a specific point in time.

Because position and time have this one-to-one relationship, we can say that position is a function of time. This means that, given a specific point in time, we can find one, and only one, corresponding position.

- Robert Penner

Linear

  • Calculates the y value for coordinate x using linear easing.

    Declaration

    Swift

    public static func linear(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

Sinusoidal

  • Calculates the y value for coordinate x using sinusoidal-in easing.

    Declaration

    Swift

    public static func sineIn(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using sinusoidal-out easing.

    Declaration

    Swift

    public static func sineOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using sinusoidal-in-out easing.

    Declaration

    Swift

    public static func sineInOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

Cubic

  • Calculates the y value for coordinate x using cubic-in easing.

    Declaration

    Swift

    public static func cubicIn(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using cubic-out easing.

    Declaration

    Swift

    public static func cubicOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using cubic-in-out easing.

    Declaration

    Swift

    public static func cubicInOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

Quadratic

  • Calculates the y value for coordinate x using quadratic-in easing.

    Declaration

    Swift

    public static func quadIn(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using quadratic-out easing.

    Declaration

    Swift

    public static func quadOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using quadratic-in-out easing.

    Declaration

    Swift

    public static func quadInOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

Quartic

  • Calculates the y value for coordinate x using quartic-in easing.

    Declaration

    Swift

    public static func quartIn(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using quartic-out easing.

    Declaration

    Swift

    public static func quartOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using quartic-in-out easing.

    Declaration

    Swift

    public static func quartInOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

Quintic

  • Calculates the y value for coordinate x using quintic-in easing.

    Declaration

    Swift

    public static func quintIn(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using quintic-out easing.

    Declaration

    Swift

    public static func quintOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using quintic-in-out easing.

    Declaration

    Swift

    public static func quintInOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

Exponential

  • Calculates the y value for coordinate x using exponential-in easing.

    Declaration

    Swift

    public static func expoIn(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using exponential-out easing.

    Declaration

    Swift

    public static func expoOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using exponential-in-out easing.

    Declaration

    Swift

    public static func expoInOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

Circular

  • Calculates the y value for coordinate x using circular-in easing.

    Declaration

    Swift

    public static func circIn(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using circular-out easing.

    Declaration

    Swift

    public static func circOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using circular-in-out easing.

    Declaration

    Swift

    public static func circInOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

Back

  • Calculates the y value for coordinate x using back-in easing.

    Declaration

    Swift

    public static func backIn(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using back-out easing.

    Declaration

    Swift

    public static func backOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using back-in-out easing.

    Declaration

    Swift

    public static func backInOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

Elastic

  • Calculates the y value for coordinate x using elastic-in easing.

    Declaration

    Swift

    public static func elasticIn(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using elastic-out easing.

    Declaration

    Swift

    public static func elasticOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using elastic-in-out easing.

    Declaration

    Swift

    public static func elasticInOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

Bounce

  • Calculates the y value for coordinate x using bounce-in easing.

    Declaration

    Swift

    public static func bounceIn(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using bounce-out easing.

    Declaration

    Swift

    public static func bounceOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].

  • Calculates the y value for coordinate x using bounce-in-out easing.

    Declaration

    Swift

    public static func bounceInOut(_ x: Double) -> Double

    Parameters

    x

    The x coordinate to which the y value is returned, between [0, 1].

    Return Value

    The y value for coordinate x, between [0, 1].