Перейти к основному содержанию

Animation

Animations are used to display some 3d models in the world without use of entities.

@remarks

Rendering performs locally in client-side, use packets to transfer data between server and players.

Index

Classes

Classes

Base

Base:

Base animations are used to display arbitrary model in the world.

constructor

  • new Base(x: number, y: number, z: number): Base
  • Constructs a new Base animation on the specified coordinates.


    Parameters

    • x: number
    • y: number
    • z: number

    Returns Base

createRenderIfNeeded

  • createRenderIfNeeded(): void
  • Creates render if it was not previously created and applies all the parameters from animation description.


    Returns void

describe

  • describe(description: { material?: string; mesh?: RenderMesh; render?: number; scale?: number; skin?: string }): void
  • Describes animation parameters for the future use. Call load or loadCustom to actually launch the animation.


    Parameters

    • description: { material?: string; mesh?: RenderMesh; render?: number; scale?: number; skin?: string }

      an object containing all the required data about animation

      • optionalmaterial: string

        Animation material, can be used to apply custom materials to the animation.

        @since

        2.0.2b20

      • optionalmesh: RenderMesh

        RenderMesh object to be displayed with animation.

        @since

        2.0.2b20

      • optionalrender: number

        Numeric ID of the Render object to be displayed with animation. Can be obtained using Render.getId

      • optionalscale: number = 1

        Animation scale.

      • optionalskin: string

        Name of the texture to be used as render's skin.

    Returns void

destroy

  • destroy(): void
  • Destroys animation and releases all the resources.


    Returns void

exists

  • exists(): boolean
  • @since

    2.1.0b60


    Returns boolean

getAge

  • getAge(): void
  • @deprecated

    Backwards compatibility, render doesn't have attributes.


    Returns void

getShaderUniforms

load

  • load(): void
  • Loads animation in the world.


    Returns void

loadCustom

  • loadCustom(func: () => void): void
  • Loads animation in the world registering it as an Updatable.

    @since

    2.3.1b116 (client-side)


    Parameters

    Returns void

newTransform

  • newTransform(transformations: { name: string; params: any[] }[], noClear: boolean): void
  • Creates a set of transformations for the current animation.


    Parameters

    • transformations: { name: string; params: any[] }[]
    • noClear: boolean

    Returns void

refresh

  • refresh(): void
  • Refreshes the animation.


    Returns void

resetBlockLightPos

  • resetBlockLightPos(): void
  • Resets light measuring position for the animation (to it's coordinates).


    Returns void

setBlockLightPos

  • setBlockLightPos(x: number, y: number, z: number): void
  • Sets specified coordinates as light measuring position for the animation. In other words, animation lightning will be calculated as if animation was at the specified coordinates.


    Parameters

    • x: number
    • y: number
    • z: number

    Returns void

setBlocklightMode

  • setBlocklightMode(): void
  • Sets light measuring to match the animation coordinated.


    Returns void

setIgnoreBlocklight

  • setIgnoreBlocklight(ignore: boolean): void
  • @deprecated

    Use setBlockLightPos and related methods instead.


    Parameters

    • ignore: boolean

    Returns void

setIgnoreLightMode

  • setIgnoreLightMode(): void
  • Makes the animation ignore light at all.


    Returns void

setInterpolationEnabled

  • setInterpolationEnabled(enabled: boolean): void
  • Parameters

    • enabled: boolean

      if true, animation position will be interpolated between tick calls

    Returns void

setPos

  • setPos(x: number, y: number, z: number): void
  • Changes the animation's position.


    Parameters

    • x: number
    • y: number
    • z: number

    Returns void

setSkylightMode

  • setSkylightMode(): void
  • Sets light measuring position to always match day/night lightning, even when the animation is not directly illuminated.


    Returns void

transform


  • Returns Transform

    Object for current animation's render.

updateRender

  • updateRender(): void
  • Refreshes the animation.


    Returns void

Item

Item:

Item animations are used to display items or blocks models in the world.

constructor

  • new Item(x: number, y: number, z: number): Item
  • Constructs a new Item animation on the specified coordinates.


    Parameters

    • x: number
    • y: number
    • z: number

    Returns Item

createRenderIfNeeded

  • createRenderIfNeeded(): void
  • Creates render if it was not previously created and applies all the parameters from animation description.


    Returns void

describe

  • describe(description: { material?: string; mesh?: RenderMesh; render?: number; scale?: number; skin?: string }): void
  • Describes animation parameters for the future use. Call load or loadCustom to actually launch the animation.


    Parameters

    • description: { material?: string; mesh?: RenderMesh; render?: number; scale?: number; skin?: string }

      an object containing all the required data about animation

      • optionalmaterial: string

        Animation material, can be used to apply custom materials to the animation.

        @since

        2.0.2b20

      • optionalmesh: RenderMesh

        RenderMesh object to be displayed with animation.

        @since

        2.0.2b20

      • optionalrender: number

        Numeric ID of the Render object to be displayed with animation. Can be obtained using Render.getId

      • optionalscale: number = 1

        Animation scale.

      • optionalskin: string

        Name of the texture to be used as render's skin.

    Returns void

describeItem

  • describeItem(item: { count?: number; data?: number; extra?: ItemExtraData; glint?: boolean; id: number; material?: string; notRandomize?: boolean; rotation?: string | [number, number, number]; size?: number; skin?: string }): void
  • Describes item to be used for the animation.


    Parameters

    • item: { count?: number; data?: number; extra?: ItemExtraData; glint?: boolean; id: number; material?: string; notRandomize?: boolean; rotation?: string | [number, number, number]; size?: number; skin?: string }

      item parameters object

      • optionalcount: number

        Item count, will be transform to display an appropriate animation.

      • optionaldata: number

        Item data.

      • optionalextra: ItemExtraData

        Item extra.

      • optionalglint: boolean

        Whether the item should be in glint state or not.

      • id: number

        Item ID.

      • optionalmaterial: string

        Shader material name.

        @since

        2.0.2b20

      • optionalnotRandomize: boolean

        If true, the position of the item will not be randomized.

      • optionalrotation: string | [number, number, number]

        If string "x" is passed, the item is rotated 90 along x axis, if "z" is passed, the item is rotated 90 along z axis, otherwise the item is rotated according to the rotation array along all the three axes.

      • optionalsize: number = 0.5

        Item/block size.

      • optionalskin: string

        Skin name to be used for the render. If no skin is passed, default item skin is used.

    Returns void

describeItemDefault

  • describeItemDefault(item: any): void
  • @deprecated

    Consider using describeItem instead.


    Parameters

    • item: any

    Returns void

destroy

  • destroy(): void
  • Destroys animation and releases all the resources.


    Returns void

exists

  • exists(): boolean
  • @since

    2.1.0b60


    Returns boolean

getAge

  • getAge(): void
  • @deprecated

    Backwards compatibility, render doesn't have attributes.


    Returns void

getShaderUniforms

  • @since

    2.0.2b20


    Returns ShaderUniformSet

    Object for current animation's render.

load

  • load(): void
  • Loads animation in the world.


    Returns void

loadCustom

  • loadCustom(func: () => void): void
  • Loads animation in the world registering it as an Updatable.

    @since

    2.3.1b116 (client-side)


    Parameters

    Returns void

newTransform

  • newTransform(transformations: { name: string; params: any[] }[], noClear: boolean): void
  • Creates a set of transformations for the current animation.


    Parameters

    • transformations: { name: string; params: any[] }[]
    • noClear: boolean

    Returns void

refresh

  • refresh(): void
  • Refreshes the animation.


    Returns void

resetBlockLightPos

  • resetBlockLightPos(): void
  • Resets light measuring position for the animation (to it's coordinates).


    Returns void

resetTransform

  • resetTransform(): void
  • Resets all the transformations made via transform calls.


    Returns void

setBlockLightPos

  • setBlockLightPos(x: number, y: number, z: number): void
  • Sets specified coordinates as light measuring position for the animation. In other words, animation lightning will be calculated as if animation was at the specified coordinates.


    Parameters

    • x: number
    • y: number
    • z: number

    Returns void

setBlocklightMode

  • setBlocklightMode(): void
  • Sets light measuring to match the animation coordinated.


    Returns void

setIgnoreBlocklight

  • setIgnoreBlocklight(ignore: boolean): void
  • @deprecated

    Use setBlockLightPos and related methods instead.


    Parameters

    • ignore: boolean

    Returns void

setIgnoreLightMode

  • setIgnoreLightMode(): void
  • Makes the animation ignore light at all.


    Returns void

setInterpolationEnabled

  • setInterpolationEnabled(enabled: boolean): void
  • Parameters

    • enabled: boolean

      if true, animation position will be interpolated between tick calls

    Returns void

setItemRotation

  • setItemRotation(x: number, y: number, z: number): void
  • Specifies item rotation along the three axes.


    Parameters

    • x: number
    • y: number
    • z: number

    Returns void

setItemSize

  • setItemSize(size: number): void
  • Specifies item size.


    Parameters

    • size: number

    Returns void

setItemSizeAndRotation

  • setItemSizeAndRotation(size: number, x: number, y: number, z: number): void
  • Specifies item size and rotation via single function call.


    Parameters

    • size: number
    • x: number
    • y: number
    • z: number

    Returns void

setPos

  • setPos(x: number, y: number, z: number): void
  • Changes the animation's position.


    Parameters

    • x: number
    • y: number
    • z: number

    Returns void

setSkylightMode

  • setSkylightMode(): void
  • Sets light measuring position to always match day/night lightning, even when the animation is not directly illuminated.


    Returns void

transform


  • Returns Transform

    Object for current animation's render.

updateRender

  • updateRender(): void
  • Refreshes the animation.


    Returns void

Page Options