BasicAnimation

public struct BasicAnimation<Value: VectorConvertible>: ValueAnimationType

Interpolates between values over a specified duration.

  • The initial value at time 0.

    Declaration

    Swift

    fileprivate (set) public var from: Value
  • to

    The final value when the animation is finished.

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    fileprivate (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

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

    Declaration

    Swift

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