tsParticles - v4.3.2
    Preparing search index...

    The background options used by the canvas element, it's not drawn, it's applied in the style [[include:Options/Background.md]]

    interface IBackground {
        color: string | IRangeColor;
        draw?: (context: BackgroundDrawContext, delta: IDelta) => void;
        element?:
            | string
            | HTMLCanvasElement
            | OffscreenCanvas
            | HTMLVideoElement
            | HTMLImageElement;
        image: string;
        opacity: number;
        position: string;
        repeat: string;
        size: string;
    }

    Implemented by

    Index

    Properties

    color: string | IRangeColor

    The color property can be set to a HEX string or to a color object, that is the same as the one used in particles.color options.

    This color is set to canvas style background-color property, if this property is not set the background will be transparent.

    draw?: (context: BackgroundDrawContext, delta: IDelta) => void

    An optional per-frame callback for custom background rendering. When specified, it is called each frame after the canvas is cleared and before particles are drawn. The callback receives the drawing context and delta time.

    element?:
        | string
        | HTMLCanvasElement
        | OffscreenCanvas
        | HTMLVideoElement
        | HTMLImageElement

    An optional external element (CSS selector, canvas, video, image, or OffscreenCanvas) that is auto-drawn onto the main canvas each frame via ctx.drawImage(). The element is not managed by the engine — external code handles its rendering.

    image: string

    The image property sets the canvas style background-image property.

    This property doesn't have a default value, anyway if you need a background image you need to specify the same CSS syntax with the url() function.

    opacity: number

    The opacity property sets the color property opacity, so you can set a semi-transparent background.

    This value is by default to 1 and it accepts any value between 0 and 1 included.

    position: string

    The position property sets the canvas style background-position property.

    This link can be useful to set the right value to this property.

    repeat: string

    The repeat property sets the canvas style background-repeat property.

    This link can be useful to set the right value to this property.

    size: string

    The size property sets the canvas style background-size property.

    This link can be useful to set the right value to this property.