VectorConvertible
public protocol VectorConvertible: Equatable, Interpolatable
Conforming types can be converted to and from vector types.
-
The concrete VectorType implementation that can represent the conforming type.
Declaration
Swift
associatedtype Vector: VectorType
-
Creates a new instance from a vector.
Declaration
Swift
init(vector: Vector)
-
The vector representation of this instance.
Declaration
Swift
var vector: Vector
-
zero
Extension methodReturns an instance initialized using the zero vector.
Declaration
Swift
public static var zero: Self
-
interpolatedTo(_:alpha:)
Extension methodInterpolates 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, and1
returns theto
value.Return Value
The interpolated result.
-
interpolateTo(_:alpha:)
Extension methodInterpolates 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, and1
assumes the value ofto
.
-
animateTo(_:duration:timingFunction:callback:)
Extension methodAnimates 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.
-
springTo(_:configuration:callback:)
Extension methodAnimates 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.