tsParticles - v4.5.3
    Preparing search index...

    Canvas manager

    Index
    • get settings(): CanvasRenderingContext2DSettings | undefined

      Canvas rendering context settings

      Returns CanvasRenderingContext2DSettings | undefined

      the canvas context settings

    • Clears the canvas content through the layer system.

      First checks plugins registered in the dedicated #canvasClearPlugins array, then iterates all layers in ordinal order (0–7) for any additional canvasClear implementations. Plugins registered on multiple layers are only visited once (deduplicated via a visited set).

      The first plugin that returns true short-circuits the clear. If no plugin handles it, falls back to canvasClear which respects actualOptions.clear.

      Returns IContainerPlugin | undefined

      the plugin that handled the clear, or undefined when the plain clear ran

      IContainerPlugin.canvasClear

    • Draws all particles for the current frame via the layer-based rendering pipeline.

      Layer order (back to front): 0. BackgroundElement — auto-draw background.element via ctx.drawImage

      1. BackgroundDraw — execute background.draw(ctx, delta) callback
      2. BackgroundMask — plugin.canvasPaint() for each plugin
      3. CanvasSetup — plugin.drawSettingsSetup(ctx, delta) for each plugin
      4. PluginContent — plugin.draw(ctx, delta) for each plugin
      5. Particles — particles.drawParticles(delta) (core particle rendering)
      6. CanvasCleanup — plugin.clearDraw() + plugin.drawSettingsCleanup() for each plugin
      7. Foreground — reserved for future overlay/fx

      Parameters

      • delta: IDelta

        The delta time

      Returns void

      DrawLayer

    • Initializes the plugins needed by canvas.

      Assigns each plugin to ALL layers where it has relevant hooks, not just one primary layer. This enables plugins that implement multiple hooks (canvasPaint→BackgroundMask, drawSettingsSetup→CanvasSetup, drawSettingsCleanup→CanvasCleanup) to participate in all the layers they need.

      Hook-independent features (particleFillColor, particleStrokeColor, drawParticle, drawParticleSetup, drawParticleCleanup) are collected into separate arrays for per-particle use during rendering.

      Returns void

      • DrawLayer
      • IContainerPlugin
    • Paints the canvas background with an optional base color

      Parameters

      • OptionalbaseColor: string

        The baseColor

      Returns void

    • Sets the canvas rendering context settings

      Parameters

      • settings: CanvasRenderingContext2DSettings

        The settings

      Returns void

    • Updates the cached background element from the effective container options

      Returns void