Spine动画渲染节点。

  • Event.PLAYED:动画开始播放调度。
  • Event.STOPPED:动画停止播放调度。
  • Event.PAUSED:动画暂停播放调度。
  • Event.LABEL:自定义事件。

spine render node.

  • Event.PLAYED:Animation start play dispatch.
  • Event.STOPPED:Animation stop play dispatch.
  • Event.PAUSED:Animation pause play dispatch.
  • Event.LABEL:Custom event.

层级 (查看完整内容)

属性

Extra data of the node.

组件的额外数据。IDE内部使用。

_id: number

Unique identifier for the component.

组件的唯一标识。

_singleton: boolean

Whether the component is a singleton, meaning only one instance of this type of script can be added to the same node.

是否为单例,即同一个节点只能添加此类型的脚本一次。

owner: Sprite

Gets the owner Node to which the component belongs.

获取组件所属的 Node 节点。

physicsUpdate: number = 2

物理更新模式。

The physics update mode.

runInEditor: boolean

Whether the script can run in the IDE environment.

是否可以在 IDE 环境中运行。

scriptPath: string

The path of the script file.

脚本文件的路径。

BASERENDER2DCOLOR: number

渲染节点颜色ID

BASERENDER2DTEXTURE: number

渲染节点纹理ID

BASERENDERSIZE: number

渲染节点size ID

NORMAL2DSTRENGTH: number
NORMAL2DTEXTURE: number

渲染节点纹理ID

PAUSED: number = 1

状态-暂停

PLAYING: number = 2

状态-播放中

SHADERDEFINE_BASERENDER2D: ShaderDefine

2D渲染节点宏

SHADERDEFINE_LIGHT2D_ADDMODE: ShaderDefine
SHADERDEFINE_LIGHT2D_EMPTY: ShaderDefine
SHADERDEFINE_LIGHT2D_ENABLE: ShaderDefine

2D灯光宏

SHADERDEFINE_LIGHT2D_NORMAL_PARAM: ShaderDefine
SHADERDEFINE_LIGHT2D_SUBMODE: ShaderDefine
STOPPED: number = 0

状态-停止

访问器

  • get useFastRender(): boolean
  • 返回 boolean

    是否使用快速渲染,默认开启,某些复杂的Spine开启此值会渲染错误,比如spine资源中某个顶点的骨骼控制数大于4

    Whether to use fast rendering. It is enabled by default. When some complex spines are enabled, this value will render errors. For example, the number of bone controls of a vertex in the spine resource is greater than 4.

  • set useFastRender(value): void
  • 参数

    • value: boolean

    返回 void

方法

  • 参数

    • nameOrIndex: string | number

      动画名字或者索引

    • loop: boolean = false

      是否循环播放

    • delay: number = 0

      延迟调用,可以为负数

    返回 void

    添加一个动画

    Add an animation

  • 返回 void

    切换至快速渲染模式,开启后可以大幅度提升渲染性能,但是有骨骼顶点限制,比如spine资源中某个顶点的骨骼控制数不能大于4

    Use fast rendering mode, which can greatly improve rendering performance but has limitations on bone vertices. For example, the number of bones controlling a vertex in spine resources cannot be greater than 4

  • 返回 void

    切换至普通渲染模式,采用未优化过的Spine运行时,性能不如快速渲染模式,但没有骨骼顶点限制

    Switch to normal rendering mode, which uses the unoptimized Spine runtime and has no bone vertex limitations. Performance is not as good as fast rendering mode.

  • 参数

    • boneName: string

      骨骼名称

    返回 Bone

    获取骨骼信息(spine.Bone)

    • 注意: 获取到的是spine运行时的骨骼信息(spine.Bone),不适用引擎的方法

    Get the bone information (spine.Bone)

    • Note: Get the spine runtime bone information (spine.Bone), not the engine method.
  • 返回 void

    Called after the component is added to a node. Unlike Awake, onAdded is called even if the node is not active.

    组件被添加到节点后调用,与 onAwake 不同的是,即使节点未激活也会调用 onAdded。

  • 返回 void

    Executed after the component is activated. At this point, all nodes and components have been created. This method is executed only once.

    组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次。

  • 返回 void

    Resets the component's parameters to their default values. If this function is implemented, the component will be reset and automatically recycled for future use. If not reset, it will not be recycled for reuse.

    将组件的参数重置为默认值。如果实现了这个函数,组件将被重置并自动回收到对象池,方便下次复用。 如果没有重置,则不会进行回收复用。

  • 参数

    • x: number

      X轴坐标

    • y: number

      Y轴坐标

    返回 void

    根据给定的坐标移动物体,支持Spine物理时有效(不能低于Spine4.2版本)

    Move the object according to the given coordinates, effective when Spine physics is enabled (cannot be lower than version 4.2 of Spine)

  • 参数

    • nameOrIndex: string | number

      Spine动画名字或者索引

    • loop: boolean

      是否循环播放

    • force: boolean = true

      false,如果要播的动画跟上一个相同就不生效,true,强制生效

    • start: number = 0

      起始时间

    • end: number = 0

      结束时间

    • freshSkin: boolean = true

      是否刷新皮肤数据

    • playAudio: boolean = true

      是否播放音频

    返回 void

    播放动画

    Play Spine animation.

  • 返回 void

    重置外部加载的皮肤数据。更换附件或皮肤数据后,需要调用此方法,否则不会生效。

    Resets the external loaded skin data. After replacing attachments or skin data, this method needs to be called, otherwise it will not take effect.

  • 参数

    • fromNameOrIndex: any

      原来的动画名字或者索引

    • toNameOrIndex: any

      目标的动画名字或者索引

    • duration: number

      混合(交叉淡出)的持续时间

    返回 void

    设置当动画被改变时,存储混合(交叉淡出)的持续时间

    Set the duration of mixing (cross-fade) when an animation is changed.