Spine动画3D渲染节点。

Spine animation 3D render node.

层级 (查看完整内容)

属性

Extra data of the node.

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

_id: number

Unique identifier for the component.

组件的唯一标识。

_receiveShadow: boolean
_renderElements: RenderElement[] = []
_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: Sprite3D

Gets the owner Node to which the component belongs.

获取组件所属的 Node 节点。

runInEditor: boolean

Whether the script can run in the IDE environment.

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

scriptPath: string

The path of the script file.

脚本文件的路径。

访问器

  • get enableCache(): boolean
  • 返回 boolean

    是否启用缓存。启用后,Spine动画的渲染数据会自动缓存,提高重复播放的性能。

    Whether to enable cache. When enabled, the Spine animation's render data will be automatically cached, improving performance for repeated playback.

  • set enableCache(value): void
  • 参数

    • value: boolean

    返回 void

  • get geometryBounds(): Bounds
  • 返回 Bounds

    The Geometry Bounds. If this bounds is set, the render bounding box will be updated based on geometryBounds and transform, and the native layer will be sunk.

    几何包围盒, 如果设置了此包围盒,渲染包围盒会根据 geometryBounds 和变换来更新,并且原生层会下沉。

  • set geometryBounds(value): void
  • 参数

    返回 void

  • get premultipliedAlpha(): boolean
  • 返回 boolean

    是否启用透明预乘。设置属性需要使用setPremultipliedAlpha方法。

    Whether to enable transparent premultiplied. The attribute needs to be set using the setPremultipliedAlpha method.

  • 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

  • 参数

    • boneName: string

      骨骼名称

    返回 IBoneInfo

    获取骨骼信息(spine.Bone)

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

    Get the bone information (spine.Bone)

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

    获取骨骼信息(已废弃,只有 Web 运行时有准确对象)

    不再直接暴露原生spine对象,只有 Web 运行时有准确对象

    Get skeleton information (deprecated, only accurate object in Web)

  • 返回 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

      结束时间

    • playAudio: boolean = false

      Whether to play audio.

    返回 void

    播放动画

    Play Spine animation.

  • 参数

    • fromNameOrIndex: any

      原来的动画名字或者索引

    • toNameOrIndex: any

      目标的动画名字或者索引

    • duration: number

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

    返回 void

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

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

  • 参数

    • value: boolean

      Whether to enable transparent premultiplied.

    返回 void

    Set the transparent premultiplied.

    设置透明预乘。

  • 参数

    • flag: number

      The flag to set, refer to RenderBitFlag for related flags or define custom bit flags.

    • pass: boolean

      Whether to set the flag.

    返回 void

    Sets the rendering flag, where each bit represents a different culling reason, 1 indicates LOD culling.

    设置渲染标志,每一位都代表不同的淘汰原因,1表示LOD淘汰。

  • 参数

    • slotName: string

      插槽名称

    • attachmentName: string

      附件名称

    返回 void

    替换插槽皮肤

    Replace the slot skin.