dacha
    Preparing search index...

    Class Shape

    Shape component for rendering 2D geometry.

    Handles the visual representation of an actor using a shape. It can be used to render such shapes as rectangles or circles.

    // Create a basic shape
    const shape = new Shape({
    type: 'rectangle',
    size: { x: 100, y: 50 },
    strokeWidth: 2,
    strokeColor: '#000',
    strokeAlignment: 0.5,
    pixelLine: false,
    opacity: 1,
    blending: 'normal',
    disabled: false,
    sortingLayer: 'units',
    sortOffset: { x: 0, y: 0 },
    });

    // Add to actor
    actor.setComponent(shape);

    // Modify properties
    shape.opacity = 0.5; // Make semi-transparent
    shape.color = '#ff0000'; // Apply a red tint

    Hierarchy (View Summary)

    Index
    actor?: Actor
    blending: BlendingMode

    Blending mode of the shape

    disabled: boolean

    Whether the shape is disabled

    fill?: string

    Fill color of the shape

    geometry: ShapeGeometry

    Geometry of the shape

    opacity: number

    Opacity of the shape

    pixelLine: boolean

    Whether the shape stroke should remains 1 pixel wide regardless of the scale

    renderData?: RenderData

    Internal rendering data

    sortingLayer: string

    Sorting layer of the shape

    sortOffset: Point

    Center point of the shape

    strokeAlignment: number

    Alignment of the stroke relative to the path

    0 - Outside of the shape 0.5 - Center of the path 1 - Inside of the shape

    strokeColor?: string

    Color of the stroke

    strokeWidth: number

    Width of the stroke

    componentName: string