BasicAnimation

public struct BasicAnimation<Value>: Animation where Value: VectorConvertible

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: TimingFunction
  • The current value.

    Declaration

    Swift

    private (set) public var value: Value
  • Declaration

    Swift

    private (set) public var velocity: Value
  • Creates a new BasicAnimation instance.

    Declaration

    Swift

    public init(from: Value, to: Value, duration: Double, timingFunction: TimingFunction = UnitBezier.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.

  • Returns true if the advanced time is >= duration.

    Declaration

    Swift

    public var isFinished: Bool
  • Advances the animation.

    Declaration

    Swift

    public mutating func advance(by time: Double)

    Parameters

    elapsed

    The time (in seconds) to advance the animation.