Canvas manager

Constructors

Properties

_applyPostDrawUpdaters: ((particle) => void) = ...

Type declaration

    • (particle): void
    • Parameters

      Returns void

_applyPreDrawUpdaters: ((ctx, particle, radius, zOpacity, colorStyles, transform) => void) = ...

Type declaration

_applyResizePlugins: (() => void) = ...

Type declaration

    • (): void
    • Returns void

_colorPlugins: IContainerPlugin[]
_context: null | CanvasRenderingContext2D

The particles canvas context

_coverColorStyle?: string
_coverImage?: {
    image: HTMLImageElement;
    opacity: number;
}

Type declaration

  • image: HTMLImageElement
  • opacity: number
_generated: boolean
_getPluginParticleColors: ((particle) => (undefined | IHsl)[]) = ...

Type declaration

    • (particle): (undefined | IHsl)[]
    • Parameters

      Returns (undefined | IHsl)[]

_initStyle: (() => void) = ...

Type declaration

    • (): void
    • Returns void

_initTrail: (() => Promise<void>) = ...

Type declaration

    • (): Promise<void>
    • Returns Promise<void>

_mutationObserver?: MutationObserver
_originalStyle?: CSSStyleDeclaration
_paintBase: ((baseColor?) => void) = ...

Type declaration

    • (baseColor?): void
    • Parameters

      • Optional baseColor: string

      Returns void

_paintImage: ((image, opacity) => void) = ...

Type declaration

    • (image, opacity): void
    • Parameters

      • image: HTMLImageElement
      • opacity: number

      Returns void

_postDrawUpdaters: IParticleUpdater[]
_preDrawUpdaters: IParticleUpdater[]
_repairStyle: (() => void) = ...

Type declaration

    • (): void
    • Returns void

_resetOriginalStyle: (() => void) = ...

Type declaration

    • (): void
    • Returns void

_resizePlugins: IContainerPlugin[]
_safeMutationObserver: ((callback) => void) = ...

Type declaration

    • (callback): void
    • Parameters

      • callback: ((observer) => void)
          • (observer): void
          • Parameters

            • observer: MutationObserver

            Returns void

      Returns void

_setFullScreenStyle: (() => void) = ...

Type declaration

    • (): void
    • Returns void

_trailFill?: ITrailFillData
container: Container

the parent container

element?: HTMLCanvasElement

The particles canvas

The particles canvas dimension

Accessors

Methods

  • Generic draw method, for drawing stuff on the canvas context

    Type Parameters

    • T

    Parameters

    • cb: ((context) => T)
        • (context): T
        • Parameters

          • context: CanvasRenderingContext2D

          Returns T

    Returns undefined | T

    the result of the callback

  • Type Parameters

    • T

    Parameters

    • cb: ((context) => T)
        • (context): T
        • Parameters

          • context: CanvasRenderingContext2D

          Returns T

    Returns undefined | T

  • Draws the specified particle in the canvas

    Parameters

    • particle: Particle

      the particle to draw

    • delta: IDelta

      the frame delta time values

    Returns void

  • Draws stuff using the given plugin, using the given particle

    Parameters

    Returns void

  • Draws stuff using the given plugin

    Parameters

    Returns void

  • Initializes the canvas element

    Returns Promise<void>

  • Initializes the canvas background

    Returns void

  • Initializes the plugins needed by canvas

    Returns void

  • Initializes the updaters needed by canvas

    Returns void

  • Loads the canvas html element

    Parameters

    • canvas: HTMLCanvasElement

      the canvas html element

    Returns void

  • Calculates the size of the canvas

    Returns boolean

    true if the size changed

  • The window resize event handler

    Returns Promise<void>