Blockbench Reference Docs
    Preparing search index...

    Texture layers always belong to a texture and represent the layers of the texture. Each layer has its own HTML canvas and canvas context

    Index

    Constructors

    Properties

    blend_mode:
        | "color"
        | "default"
        | "set_opacity"
        | "multiply"
        | "add"
        | "screen"
        | "difference"
    canvas: HTMLCanvasElement
    ctx: CanvasRenderingContext2D
    in_limbo: boolean
    name: string
    offset: ArrayVector2

    Layer offset from the top left corner of the texture to the top left corner of the layer

    opacity: number

    Layer scale. This is only used by the layer transform tool and should be applied and reset to 1x1 before doing further changes

    texture: Texture
    uuid: string
    visible: boolean

    Get all layers of the active texture

    selected: TextureLayer

    Get the selected layer

    Methods

    • Add the layer to the associated texture above the previously selected layer, select this layer, and scroll the layer panel list to it

      Returns void

    • Flip the texture along an axis

      Parameters

      • axis: number

        Flip axis, where 0 is X and 1 is Y

      • undo: boolean

        Create an undo entry

      Returns void

    • Resolves the limbo state by turning the limbo layer into a full layer, or merging it into the layer below

      Parameters

      • keep_separate: boolean

        If true, the layer is kept as a separate layer

      Returns void

    • Rotate the layer around itself in 90 degree steps

      Parameters

      • angle: number

        Angle in degrees

      • undo: boolean

        Create an undo entry

      Returns void

    • Set the layer into a limbo state, where clicking Place or clicking next to the layer will place it on the layer below

      Returns void

    • Set the layer size. This resizes the canvas, which discards the layer content

      Parameters

      • width: number
      • height: number

      Returns void