Cocos Creator API

1.3.0

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

AnimationClip

: cc

Class for animation data handling.

duration Number

Duration of this animation.

sample Number

FrameRate of this animation.

speed Number

Speed of this animation.

wrapMode WrapMode

WrapMode of this animation.

curveData Object

Curve data.

:

{
    // 根节点不用查找路径
    // root properties
    props: {
        x: [
            { frame: 0, value: 0, curve: [0,0.5,0.5,1] },
            { frame: 1, value: 200, curve: null }
        ]
    },
    comps: {
        // component
        'comp-1': {
            // component properties
            'prop-1': [
                { frame: 0, value: 10, curve: [0,0.5,0.5,1] },
                { frame: 1, value: 20, curve: null }
            ]
        }
    },
    paths: {
        // key 为节点到root的路径名, 通过cc.find找到
        'foo/bar': {
            // node properties
            props: {
                x: [
                    { frame: 0, value: 0, curve: [0,0.5,0.5,1]
                    { frame: 1, value: 200, curve: null }
                ]
            },
            comps: {
                // component
                'comp-1': {
                    // component property
                    'prop-1': [
                        { frame: 0, value: 10, curve: [0,0.5,0.
                            { frame: 1, value: 20, curve: null }
                        ]
                        }
                }
            },
            'hello': {
                props: {
                    position: [
                        {
                            frame: 0,
                            value: [0,0],
                            motionPath: [
                                [320, 240, 0, 240, 640, 240],
                                [640, 0, 400, 0, 1000, 0]
                            ]
                        },
                        { frame: 5, value: [640, 480] }
                    ]
                }
            }
        }
    }
}

events Array

Event data.

:

// frame    : The exactly time in second.
// func     : Callback function name
// params   : Callback parameters
[
    { frame: 0, func: 'onAnimationEvent1', params:['param-1', 'param-2'] },
    { frame: 2, func: 'onAnimationEvent3', params:['param-1', 'param-2'] },
    { frame: 3, func: 'onAnimationEvent2', params:['param-1'] },
    // The second event at frame 3
    { frame: 3, func: 'onAnimationEvent4', params:['param-1'] },
    { frame: 4, func: 'onAnimationEvent4', params:['param-1'] }
]

rawUrl String readOnly

Returns the url of this asset's first raw file, if none of rawFile exists, it will returns an empty string.

rawUrls String[] readOnly

Returns the url of this asset's raw files, if none of rawFile exists, it will returns an empty array.

_rawFiles String[] private

在 lite 版的 Fireball 里,raw asset 并不仅仅是在 properties 里声明了 rawType 才有, 而是每个 asset 都能指定自己的 raw file url。这些 url 就存在 _rawFiles 字段中。 AssetLibrary 并不会帮你加载这些 url,除非你声明了 rawType。

_uuid String private

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

createWithSpriteFrames
(
  • spriteFrames
  • sample
)
AnimationClip

Crate clip with a set of sprite frames

spriteFrames [SpriteFrame]
sample Number

:

var clip = cc.AnimationClip.createWithSpriteFrames(spriteFrames, 10);

serialize ( ) String private

应 AssetDB 要求提供这个方法

:

: String

createNode
(
  • callback
)

Create a new node using this asset in the scene.
If this type of asset dont have its corresponding node type, this method should be null.

callback Function
  • error String

    null or the error info

  • node Object

    the created node or null

_setRawFiles
(
  • rawFiles
)
private

Set raw file names for this asset.

rawFiles String[]

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