TweenAnimator

public final class TweenAnimator<Target> : Tween where Target : Tweenable

Maintains the state of a tween animation while invoking animation closures to interpolate and update the properties of Tweenable targets.

Animation & State Properties

Time Properties

  • Declaration

    Swift

    public var delay: TimeInterval
  • Declaration

    Swift

    public var duration: TimeInterval
  • Declaration

    Swift

    public var elapsed: TimeInterval

Callback Properties

  • Declaration

    Swift

    public var onUpdate: TweenAnimator<Target>.Callback?
  • Declaration

    Swift

    public var onStart: TweenAnimator<Target>.Callback?
  • Declaration

    Swift

    public var onStop: TweenAnimator<Target>.Callback?
  • Declaration

    Swift

    public var onRestart: TweenAnimator<Target>.Callback?
  • Declaration

    Swift

    public var onPause: TweenAnimator<Target>.Callback?
  • Declaration

    Swift

    public var onResume: TweenAnimator<Target>.Callback?
  • Declaration

    Swift

    public var onComplete: TweenAnimator<Target>.Callback?
  • Declaration

    Swift

    public var onKill: TweenAnimator<Target>.Callback?
  • Declaration

    Swift

    public var onRevive: TweenAnimator<Target>.Callback?

Tweening

  • Animates tweenable properties from the target’s current values to the desired values.

    Declaration

    Swift

    @discardableResult
    public func to(_ properties: Target.TweenProperty...) -> TweenAnimator<Target>

    Parameters

    properties

    The properties to animate.

    Return Value

    The current TweenAnimator instance to allow for additional customization.

  • Animates tweenable properties from the target’s current values to the desired values.

    Declaration

    Swift

    @discardableResult
    public func to<PropType: TweenableProperty>(_ properties: PropType...) -> TweenAnimator<Target>
        where PropType.Target == Target

    Parameters

    properties

    The properties to animate.

    Return Value

    The current TweenAnimator instance to allow for additional customization.

  • Animates tweenable properties from desired values to the target’s current values.

    Declaration

    Swift

    @discardableResult
    public func from(_ properties: Target.TweenProperty...) -> TweenAnimator<Target>

    Parameters

    properties

    The properties to animate.

    Return Value

    The current TweenAnimator instance to allow for additional customization.

  • Animates tweenable properties from desired values to the target’s current values.

    Declaration

    Swift

    @discardableResult
    public func from<PropType: TweenableProperty>(_ properties: PropType...) -> TweenAnimator<Target>
        where PropType.Target == Target

    Parameters

    properties

    The properties to animate.

    Return Value

    The current TweenAnimator instance to allow for additional customization.

State Control

  • Declaration

    Swift

    @discardableResult
    func update(by deltaTime: TimeInterval) -> Bool
  • Declaration

    Swift

    @discardableResult
    func start() -> Bool
  • Declaration

    Swift

    @discardableResult
    func stop() -> Bool
  • Declaration

    Swift

    @discardableResult
    func restart() -> Bool
  • Declaration

    Swift

    @discardableResult
    func pause() -> Bool
  • Declaration

    Swift

    @discardableResult
    func resume() -> Bool
  • Declaration

    Swift

    @discardableResult
    func complete() -> Bool
  • Declaration

    Swift

    @discardableResult
    func kill() -> Bool
  • Declaration

    Swift

    @discardableResult
    func revive() -> Bool