Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Tween

Hierarchy

Index

Constructors

constructor

  • new Tween(objStart: any): Tween

Properties

Private active

active: boolean = false

Private currentMotionIndex

currentMotionIndex: number = 0

Private isLoop

isLoop: boolean = false

Private isPaused

isPaused: boolean = false

Private keyChanges

keyChanges: any[] = []

Private motionStart

motionStart: any

Private motions

motions: any[] = []

Private obj

obj: any

Private start

start: any

Methods

addMotion

  • addMotion(key: string, target: number, duration: number, easing?: string): Tween
  • Adds a new motion to the tween object. When the tween is playing it will change the the defined key of the given object to make an animation.

    Parameters

    • key: string

      expects the name of the effected key of the given object from constructor

    • target: number

      expects the value for ending postion if this motion

    • duration: number

      expects the duration of this motion in milliseconds

    • Default value easing: string = "linear"

      optional: the name of the easing-function (default is 'linear')

    Returns Tween

addMotions

  • addMotions(actions: { key: string; target: number }[], duration: number, easing?: string): Tween
  • Adds a new combined motion to the tween objects. In actions are some motions combined, which should be changed in the same time. When the tween is playing it will change the the defined key of the given object to make an animation.

    Parameters

    • actions: { key: string; target: number }[]

      expects an array of key-target pairs for this motion

    • duration: number

      expects the duration of this motion in milliseconds

    • Default value easing: string = "linear"

      optional: the name of the easing-function (default is 'linear')

    Returns Tween

Private addToKeyChangeList

  • addToKeyChangeList(key: string): void
  • Parameters

    • key: string

    Returns void

Private createStartObject

  • createStartObject(objStart: any): {}
  • Parameters

    • objStart: any

    Returns {}

Private interpolation

  • interpolation(start: number, stop: number, amt: number, easing?: string): number
  • Parameters

    • start: number
    • stop: number
    • amt: number
    • Default value easing: string = "linear"

    Returns number

pause

resetMotions

  • resetMotions(): void
  • Removes all motions from this tween

    Returns void

Private resetToStart

  • resetToStart(): void

restart

resume

  • Starts the tween from the current state, when the tween was paused

    Returns Tween

startLoop

  • Starts the tween and plays it again and again.

    Returns Tween

startTween

update

  • update(deltaTime: number): void
  • Parameters

    • deltaTime: number

    Returns void

Generated using TypeDoc