VectorConvertible

public protocol VectorConvertible: Equatable, Interpolatable

Conforming types can be converted to and from vector types.

  • Creates a new instance from a vector.

    Declaration

    Swift

    init(vector: Vector)
  • The concrete VectorType implementation that can represent the conforming type.

    Declaration

    Swift

    typealias Vector: VectorType
  • The vector representation of this instance.

    Declaration

    Swift

    var vector: Vector { get }
  • 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.

    Returns

    The interpolated result.

    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: (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: (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.