Constructors

  • The absorber constructor, initializes the absorber based on the given options and position

    Parameters

    • absorbers: Absorbers

      the Absorbers collection manager that will contain this absorber

    • container: Container

      the Container engine using the absorber plugin, containing the particles that will interact with this Absorber

    • options: RecursivePartial<IAbsorber>

      the Absorber source options

    • Optional position: ICoordinates

      the Absorber optional position, if not given, it will be searched in options, and if not available also there, a random one will be used

    Returns AbsorberInstance

Properties

_calcPosition: (() => Vector) = ...

Type declaration

    • (): Vector
    • Internal

      This method calculate the absorber position, using the provided options and position

      Returns Vector

      the calculated position for the absorber

_updateParticlePosition: ((particle, v) => void) = ...

Type declaration

    • (particle, v): void
    • Internal

      Updates the particle position, if the particle needs a new position

      Parameters

      • particle: OrbitingParticle

        the particle to update

      • v: Vector

        the vector used for calculating the distance between the Absorber and the particle

      Returns void

absorbers: Absorbers

the Absorbers collection manager that will contain this absorber

color: IRgb

The absorber color

container: Container

the Container engine using the absorber plugin, containing the particles that will interact with this Absorber

dragging: boolean

Sets if the absorber can be moved with mouse drag&drop

initialPosition?: Vector

Gets the absorber initial position

The absorber size limit

mass: number

The absorber mass, this increases the attraction force

name?: string

The absorber name, useful when retrieving it manually

opacity: number

The absorber opacity

options: Absorber

Gets the absorber options

position: Vector

The absorber position

size: number

The absorber size, great size doesn't mean great mass, it depends also on the density

Methods

  • Absorber attraction interaction, attract the particle to the absorber

    Parameters

    • particle: OrbitingParticle

      the particle to attract to the absorber

    Returns void

  • The draw method, for drawing the absorber in the canvas

    Parameters

    • context: CanvasRenderingContext2D

      the canvas 2d context used for drawing

    Returns void