VectorConvertible

public protocol VectorConvertible: Equatable, Interpolatable

Conforming types can be converted to and from vector types.

  • zero Extension method

    Returns an instance initialized using the zero vector.

    Declaration

    Swift

    public static var zero: Self
  • interpolatedTo(_:alpha:) Extension method

    Interpolates between values.

    Declaration

    Swift

    public func interpolatedTo(_ to: Self, alpha: Scalar) -> Self

    Parameters

    to

    The value to interpolate to.

    alpha

    The amount (between 0.0 and 1.0) to interpolate, where 0 returns the receiver, and 1 returns the to value.

    Return Value

    The interpolated result.

  • interpolateTo(_:alpha:) Extension method

    Interpolates in place.

    Declaration

    Swift

    public mutating func interpolateTo(_ to: Self, alpha: Scalar)

    Parameters

    to

    The value to interpolate to.

    alpha

    The amount (between 0.0 and 1.0) to interpolate, where 0 leaves the receiver unchanged, and 1 assumes the value of to.

  • Animates to the specified value.

    Declaration

    Swift

    public func animateTo(_ to: Self, duration: Double, timingFunction: TimingFunctionType, callback: @escaping (Self)->Void) -> Animator<BasicAnimation<Self>>

    Parameters

    to

    The value to animate to.

    duration

    The duration of the animation.

    timingFunction

    The timing (easing) function to use.

    callback

    A closure that will be called with the new value for each frame of the animation until it is finished.

    Return Value

    The underlying animator.

  • Animates to the given value using a spring function.

    Declaration

    Swift

    public func springTo(_ to: Self, configuration: SpringConfiguration, callback: @escaping (Self) -> Void) -> Animator<SpringAnimation<Self>>

    Parameters

    to

    The value to animate to.

    callback

    A closure that will be called at each step of the animation.

    Return Value

    The animator instance that is powering the animation.