Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Composite

Hierarchy

  • Composite

Index

Constructors

constructor

  • Parameters

    • heax: Heax

      Instance of heax class

    • iterations: number = 5

      No of times to update constraints in single frame

    Returns Composite

Properties

constraints

constraints: Constraint[] = []

Array of constraints

heax

heax: Heax

Instance of heax class

iterations

iterations: number

No of times to update constraints in single frame

particles

particles: Particle[] = []

Array if particles

Methods

addConstraint

  • Add new constraint

    example
    composit.addConstraint(1, 2, { color: "red" })

    composite.addConstraint(particle1, particle2, { width: 10 })

    composite.addConstraint(1, particle2, { width: 10 })

    Parameters

    • p1: number | Particle

      First particle

    • p2: number | Particle

      Second Particle

    • info: any

      Info about the constraint

    Returns Constraint

addParticle

  • Add new particle

    example
    composite.addParticle(0, 0, 10, 10, { color: "red" })
    

    Parameters

    • x: number

      x coordinate

    • y: number

      y coordinate

    • ox: number

      Old x coordinate

    • oy: number

      Old y coodinate

    • info: any

      Info about the particle

    Returns Particle

  • Add new particle

    example
    const pos = new Vector(10, 10)
    const oldPos = new Vector(0, 0)

    composite.addParticle(pos, oldPos, { color: "red" })

    Parameters

    • pos: Vector

      Current position of particle

    • oldPos: Vector

      Old position of particle

    • info: any

      Info about the particle

    Returns Particle

hideConstraints

hideParticles

render

tear

update

  • update(constraintBasedOnDimensionOfCanvas?: boolean): Composite
  • Update all particles and constraints

    Parameters

    • constraintBasedOnDimensionOfCanvas: boolean = true

      If particles should be stopped by the canvas height and width

    Returns Composite

Generated using TypeDoc