Cocos Creator API

1.4.x

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

MotionStreak

Extends Component
Module: cc

cc.MotionStreak manages a Ribbon based on it's motion in absolute space.
You construct it with a fadeTime, minimum segment size, texture path, texture
length and color. The fadeTime controls how long it takes each vertex in
the streak to fade out, the minimum segment size it how many pixels the
streak will move before adding a new ribbon segment, and the texture
length is the how many pixels the texture is stretched across. The texture
is vertically aligned along the streak segment.

Properties

preview Boolean

fadeTime Number

The fade time to fade.

examples:

motionStreak.fadeTime = 3;

minSeg Number

The minimum segment size.

examples:

motionStreak.minSeg = 3;

stroke Number

The stroke's width.

examples:

motionStreak.stroke = 64;

texture Texture2D

The texture of the MotionStreak.

examples:

motionStreak.texture = newTexture;

color Color

The color of the MotionStreak.

examples:

motionStreak.color = new cc.Color(255, 255, 255);

fastMode Boolean

The fast Mode.

examples:

motionStreak.fastMode = true;

__eventTargets Array private

Inherited from Component:

Register all related EventTargets, all event callbacks will be removed in _onPreDestroy

node Node

Inherited from Component:

The node this component is attached to. A component is always attached to a node.

examples:

cc.log(comp.node);

uuid String readOnly

Inherited from Component:

The uuid for editor.

examples:

cc.log(comp.uuid);

_enabled Boolean private

Inherited from Component:

enabled Boolean

Inherited from Component:

indicates whether this component is enabled or not.

examples:

comp.enabled = true;
cc.log(comp.enabled);

enabledInHierarchy Boolean readOnly

Inherited from Component:

indicates whether this component is enabled and its node is also active in the hierarchy.

examples:

cc.log(comp.enabledInHierarchy);

_isOnLoadCalled Boolean readOnly

Inherited from Component:

TODO

examples:

cc.log(_isOnLoadCalled);

_name String private

_objFlags Number private

name String

The name of the object.

examples:

obj.name = "New Obj";

isValid Boolean readOnly

Indicates whether the object is not yet destroyed.

examples:

cc.log(obj.isValid);

There are no properties that match your current filter settings. You can change your filter settings in the index section on this page. index

Methods

reset ( )

Remove all living segments of the ribbon.

examples:

// stop particle system.
myParticleSystem.stopSystem();

update ( )

Inherited from Component:

Update is called every frame, if the Component is enabled.

lateUpdate ( )

Inherited from Component:

LateUpdate is called every frame, if the Component is enabled.

__preload ( ) private

Inherited from Component:

__preload is called before every onLoad. It is used to initialize the builtin components internally, to avoid checking whether onLoad is called before every public method calls. This method should be removed if script priority is supported.

onLoad ( )

Inherited from Component:

When attaching to an active node or its node first activated.

start ( )

Inherited from Component:

Called before all scripts' update if the Component is enabled the first time.

onEnable ( )

Inherited from Component:

Called when this component becomes enabled and its node is active.