Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Tween

Tween provide a simple and flexible way to action, It's transplanted from cocos creator。

param
example

tween(this.node) .to(1, {scale: new Vec3(2, 2, 2), position: new Vec3(5, 5, 5)}) .call(() => { console.log('This is a callback'); }) .by(1, {scale: new Vec3(-1, -1, -1), position: new Vec3(-5, -5, -5)}, {easing: 'sineOutIn'}) .start()

Hierarchy

  • Tween

Index

Constructors

constructor

  • newTween(target?: object | null): Tween

Properties

Private _actions

_actions: Action[] = []

Private _finalAction

_finalAction: Action | null = null

Private _tag

_tag: number = Action.TAG_INVALID

Private _target

_target: object | null = null

Static Private Readonly _tmp_args

_tmp_args: Tween[] | Action[] = []

Methods

Private destroy

  • _destroy(): void

Private union

  • _union(): Action

by

  • Add an action which calculate with relative value.

    method

    by

    Parameters

    • duration: number

      缓动时间,单位为秒

    • props: object

      缓动的属性列表

    • Optional opts: ITweenOption

    Returns Tween

call

  • call(callback: Function): Tween

clone

  • clone(target: object): Tween

delay

  • delay(duration: number): Tween

hide

parallel

removeSelf

repeat

  • repeat(repeatTimes: number, embedTween?: Tween): Tween
  • Add an repeat action. This action will integrate before actions to a sequence action as their parameters.

    method

    repeat

    Parameters

    • repeatTimes: number

      重复次数

    • Optional embedTween: Tween

      可选,嵌入 Tween

    Returns Tween

repeatForever

  • Add an repeat forever action. This action will integrate before actions to a sequence action as their parameters.

    method

    repeatForever

    Parameters

    • Optional embedTween: Tween

      可选,嵌入 Tween

    Returns Tween

reverseTime

  • Add an reverse time action. This action will integrate before actions to a sequence action as their parameters.

    method

    reverseTime

    Parameters

    • Optional embedTween: Tween

      可选,嵌入 Tween

    Returns Tween

sequence

set

  • set(props: object): Tween

show

start

stop

tag

  • tag(tag: number): this

target

  • target(target: object | null): Tween

then

to

  • Add an action which calculate with absolute value.

    method

    to

    Parameters

    • duration: number

      缓动时间,单位为秒

    • props: object

      缓动的属性列表

    • Optional opts: ITweenOption

    Returns Tween

union

Static Private wrappedParallel

  • wrappedParallel(...args: Action[] | Tween[]): FiniteTimeAction

Static Private wrappedSequence

  • wrappedSequence(...args: Action[] | Tween[]): ActionInterval

Static stopAll

  • stopAll(): void

Static stopAllByTag

  • stopAllByTag(tag: number, target?: undefined | object): void
  • Stop all tweens by tag

    Parameters

    • tag: number
    • Optional target: undefined | object

    Returns void

Static stopAllByTarget

  • stopAllByTarget(target: any): void

Generated using TypeDoc