Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Group

A group is a class that allows you to manage many tweens from one place.

A tween will ALWAYS belong to a group. If no group is assigned it will default to the static shared group: Group.shared.

Hierarchy

  • Group

Index

Constructors

constructor

Properties

now

now: () => number = NOW

Type declaration

    • (): number
    • Function used by the group to know what time is it. Used to calculate the deltaTime in case you call update without the parameter.

      Returns number

Accessors

Static shared

  • A tween without an explicit group will default to this shared static one.

    Returns Group

Methods

add

  • add(tween: Tween<any>): void
  • Adds a tween to this group.

    note: this will not modify the group reference inside the tween object

    Parameters

    • tween: Tween<any>

      Tween to add.

    Returns void

getAll

  • Returns all the tweens in this group.

    note: only running tweens are in a group.

    Returns Tween<any>[]

    all the running tweens.

isPaused

  • isPaused(): boolean
  • A paused group will skip updating all the asociated tweens. To control all tweens, use Group.getAll to get an array with all tweens.

    Returns boolean

    returns true if this group is paused.

pause

  • pause(): void
  • Pauses this group. If a group was already paused, this has no effect. A paused group will skip updating all the asociated tweens. To control all tweens, use Group.getAll to get an array with all tweens.

    Returns void

remove

  • remove(tween: Tween<any>): void
  • Removes a tween from this group.

    note: this will not modify the group reference inside the tween object

    Parameters

    Returns void

removeAll

  • removeAll(): void
  • Removes all the tweens in this group.

    note: this will not modify the group reference inside the tween object

    Returns void

resume

  • resume(): void
  • Resumes this group. If a group was not paused, this has no effect. A paused group will skip updating all the asociated tweens. To control all tweens, use Group.getAll to get an array with all tweens.

    Returns void

update

  • update(deltaTime?: number, preserve?: boolean): boolean
  • Updates all the tweens in this group.

    If a tween is stopped, paused, finished or non started it will be removed from the group.

    Tweens are updated in "batches". If you add a new tween during an update, then the new tween will be updated in the next batch. If you remove a tween during an update, it may or may not be updated. However, if the removed tween was added during the current batch, then it will not be updated.

    Parameters

    • Optional deltaTime: number

      Amount of miliseconds that have passed since last excecution. If not provided it will be calculated using the Group.now function

    • preserve: boolean = false

      Prevent the removal of stopped, paused, finished or non started tweens.

    Returns boolean

    returns true if the group is not empty and it is not paused.

Generated using TypeDoc