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'})
  .start(cc.find('Canvas/cocos'));

Index

Methods
  • constructor
  • stopAll Stop all tweens
  • stopAllByTag Stop all tweens by tag
  • stopAllByTarget Stop all tweens by target
  • then Insert an action or tween to this sequence
  • target Set tween target
  • start Start this tween
  • stop Stop this tween
  • tag Sets tween tag
  • clone Clone a tween
  • union Integrate all previous actions to an action.
  • bezierTo Sets target's position property according to the bezier curve.
  • bezierBy Sets target's position property according to the bezier curve.
  • flipX Flips target's scaleX
  • flipY Flips target's scaleY
  • blink Blinks target by set target's opacity property
  • to Add an action which calculate with absolute value
  • by Add an action which calculate with relative value
  • set Directly set target properties
  • 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
  • parallel Add an parallel action
  • repeat Add an repeat action.
  • repeatForever Add an repeat forever action
  • reverseTime Add an reverse time action.

Details

Methods

constructor
meta description
Defined in cocos2d/actions/tween.js:182
Parameters
stopAll

Stop all tweens

meta description
Defined in cocos2d/actions/tween.js:187
stopAllByTag

Stop all tweens by tag

meta description
Defined in cocos2d/actions/tween.js:196
Parameters
stopAllByTarget

Stop all tweens by target

meta description
Defined in cocos2d/actions/tween.js:206
Parameters
then

Insert an action or tween to this sequence

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:217
Parameters
target

Set tween target

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:238
Parameters
start

Start this tween

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:253
stop

Stop this tween

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:286
tag

Sets tween tag

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:303
Parameters
clone

Clone a tween

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:317
Parameters
union

Integrate all previous actions to an action.

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:332
bezierTo

Sets target's position property according to the bezier curve.

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:362
Parameters
  • duration number
  • c1 cc.Vec2
  • c2 cc.Vec2
  • to cc.Vec2
bezierBy

Sets target's position property according to the bezier curve.

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:385
Parameters
  • duration number
  • c1 cc.Vec2
  • c2 cc.Vec2
  • to cc.Vec2
flipX

Flips target's scaleX

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:409
flipY

Flips target's scaleY

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:420

Blinks target by set target's opacity property

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:431
Parameters
to

Add an action which calculate with absolute value

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:476
Parameters
by

Add an action which calculate with relative value

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:497
Parameters
set

Directly set target properties

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:518
Parameters
delay

Add an delay action

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:533
Parameters
call

Add an callback action

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:544
Parameters
hide

Add an hide action

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:555
show

Add an show action

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:565
removeSelf

Add an removeSelf action

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:575
sequence

Add an sequence action

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:585
Parameters
parallel

Add an parallel action

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:597
Parameters
repeat

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

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:613
Parameters
repeatForever

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

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:626
Parameters
reverseTime

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

meta description
Returns Tween
Defined in cocos2d/actions/tween.js:641
Parameters

results matching ""

    No results matching ""