Tween Class

Module: cc

Tween provide a simple and flexible way to create action. Tween's api is more flexible than cc.Action:

  • Support creating an action sequence in chained api,
  • Support animate any objects' any properties, not limited to node's properties. By contrast, cc.Action needs to create a new action class to support new node property.
  • Support working with cc.Action,
  • Support easing and progress function,
Examples
cc.tween(node)
  .to(1, {scale: 2, position: cc.v3(100, 100, 100)})
  .call(() => { console.log('This is a callback'); })
  .by(1, {scale: 3, position: cc.v3(200, 200, 200)}, {easing: 'sineOutIn'})
  .run(cc.find('Canvas/cocos'));

Index

Methods
  • then Insert an action or tween to this sequence
  • target Set tween target
  • start Start this tween
  • stop Stop this tween
  • clone Clone a tween
  • to Add an action which calculate with absolute value
  • by Add an action which calculate with relative value
  • delay Add an delay action
  • call Add an callback action
  • hide Add an hide action
  • show Add an show action
  • removeSelf Add an removeSelf action
  • sequence Add an sequence action
  • repeat Add an repeat action.
  • repeatForever Add an repeat forever action
  • reverseTime Add an reverse time action.
  • tween

Details

Methods

then

Insert an action or tween to this sequence

meta description
Defined in cocos2d/actions/tween.js:136
Parameters
target

Set tween target

meta description
Defined in cocos2d/actions/tween.js:157
start

Start this tween

meta description
Defined in cocos2d/actions/tween.js:169
stop

Stop this tween

meta description
Defined in cocos2d/actions/tween.js:188
clone

Clone a tween

meta description
Defined in cocos2d/actions/tween.js:204
Parameters
to

Add an action which calculate with absolute value

meta description
Defined in cocos2d/actions/tween.js:238
Parameters
by

Add an action which calculate with relative value

meta description
Defined in cocos2d/actions/tween.js:256
Parameters
delay

Add an delay action

meta description
Defined in cocos2d/actions/tween.js:274
Parameters
call

Add an callback action

meta description
Defined in cocos2d/actions/tween.js:283
Parameters
hide

Add an hide action

meta description
Defined in cocos2d/actions/tween.js:292
show

Add an show action

meta description
Defined in cocos2d/actions/tween.js:300
removeSelf

Add an removeSelf action

meta description
Defined in cocos2d/actions/tween.js:308
sequence

Add an sequence action

meta description
Defined in cocos2d/actions/tween.js:316
Parameters
repeat

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

meta description
Defined in cocos2d/actions/tween.js:329
Parameters
repeatForever

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

meta description
Defined in cocos2d/actions/tween.js:339
reverseTime

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

meta description
Defined in cocos2d/actions/tween.js:348
tween
meta description
Returns Tween
Defined in cocos2d/actions/tween.js:391
Parameters
  • target Object the target to animate

results matching ""

    No results matching ""