API Docs for: 0.7.1
Show:

Solver Class

Extends EventEmitter

Base class for constraint solvers.

Constructor

Solver

()

Methods

addEquation

(
  • eq
)

Add an equation to be solved.

Parameters:

addEquations

(
  • eqs
)

Add equations. Same as .addEquation, but this time the argument is an array of Equations

Parameters:

  • eqs Array

emit

(
  • event
)
EventEmitter

Emit an event.

Parameters:

  • event Object
    • type String

Returns:

EventEmitter:

The self object, for chainability.

has

(
  • type
  • listener
)
Boolean

Check if an event listener is added

Parameters:

  • type String
  • listener Function

Returns:

Boolean:

off

(
  • type
  • listener
)
EventEmitter

Remove an event listener

Parameters:

  • type String
  • listener Function

Returns:

EventEmitter:

The self object, for chainability.

on

(
  • type
  • listener
)
EventEmitter

Add an event listener

Parameters:

  • type String
  • listener Function

Returns:

EventEmitter:

The self object, for chainability.

removeAllEquations

()

Remove all currently added equations.

removeEquation

(
  • eq
)

Remove an equation.

Parameters:

solve

(
  • dt
  • world
)

Method to be implemented in each subclass

Parameters:

solveIsland

(
  • dt
  • island
)

Solves all constraints in an island.

Parameters:

sortEquations

()

Sort all equations using the .equationSortFunction. Should be called by subclasses before solving.

Properties

equations

Array

Current equations in the solver.

equationSortFunction

Function | Boolean

Function that is used to sort all equations before each solve.