BasicAnimation

public struct BasicAnimation<Value: VectorConvertible>: ValueAnimationType

Interpolates between values over a specified duration.

  • The initial value at time 0.

    Declaration

    Swift

    private (set) public var from: Value
  • to

    The final value when the animation is finished.

    Declaration

    Swift

    private (set) public var to: Value
  • The duration of the animation in seconds.

    Declaration

    Swift

    private (set) public var duration: Double
  • The timing function that is used to map elapsed time to an interpolated value.

    Declaration

    Swift

    private (set) public var timingFunction: TimingFunctionType
  • Creates a new BasicAnimation instance.

    Declaration

    Swift

    public init(from: Value, to: Value, duration: Double, timingFunction: TimingFunctionType = UnitBezier(preset: .SwiftOut))

    Parameters

    from

    The value at time 0.

    to

    The value at the end of the animation.

    duration

    How long (in seconds) the animation should last.

    timingFunction

    The timing function to use.

  • The current value.

    Declaration

    Swift

    private(set) public var value: Value
  • The current velocity.

    Declaration

    Swift

    private(set) public var velocity: Value
  • Returns true if the advanced time is >= duration.

    Declaration

    Swift

    public var finished: Bool
  • Advances the animation.

    Declaration

    Swift

    public mutating func advance(time: Double)

    Parameters

    elapsed

    The time (in seconds) to advance the animation.