packages/flip-toolkit/src/forked-rebound/SpringSystem.js
/**
   * This is the main solver loop called to move the simulation
   * forward through time. Before each pass in the solver loop
   * onBeforeIntegrate is called on an any listeners that have
   * registered themeselves with the SpringSystem. This gives you
   * an opportunity to apply any constraints or adjustments to
   * the springs that should be enforced before each iteration
   * loop. Next the advance method is called to move each Spring in
   * the systemShouldAdvance forward to the current time. After the
   * integration step runs in advance, onAfterIntegrate is called
   * on any listeners that have registered themselves with the
   * SpringSystem. This gives you an opportunity to run any post
   * integration constraints or adjustments on the Springs in the
   * SpringSystem.
   * @public
   */
This is the main solver loop called to move the simulation
forward through time. Before each pass in the solver loop
onBeforeIntegrate is called on an any listeners that have
registered themeselves with the SpringSystem. This gives you
an opportunity to apply any constraints or adjustments to
the springs that should be enforced before each iteration
loop. Next the advance method is called to move each Spring in
the systemShouldAdvance forward to the current time. After the
integration step runs in advance, onAfterIntegrate is called
on any listeners that have registered themselves with the
SpringSystem. This gives you an opportunity to run any post
integration constraints or adjustments on the Springs in the
SpringSystem.
@public
This is the main solver loop called to move the simulation forward through time . Before each pass in the solver loop onBeforeIntegrate is called on an any listeners that have registered themeselves with the SpringSystem . This gives you an opportunity to apply any constraints or adjustments to the springs that should be enforced before each iteration loop . Next the advance method is called to move each Spring in the systemShouldAdvance forward to the current time . After the integration step runs in advance onAfterIntegrate is called on any listeners that have registered themselves with the SpringSystem . This gives you an opportunity to run any post integration constraints or adjustments on the Springs in the SpringSystem . @public
loop(currentTimeMillis) {
    let listener
    if (this._lastTimeMillis === -1) {
      this._lastTimeMillis = currentTimeMillis - 1
    }
    const ellapsedMillis = currentTimeMillis - this._lastTimeMillis
    this._lastTimeMillis = currentTimeMillis
    let i = 0
    const len = this.listeners.length
    for (i = 0; i < len; i++) {
      listener = this.listeners[i]
      listener.onBeforeIntegrate && listener.onBeforeIntegrate(this)
    }
    this.advance(currentTimeMillis, ellapsedMillis)
    if (this._activeSprings.length === 0) {
      this._isIdle = true
      this._lastTimeMillis = -1
    }
    for (i = 0; i < len; i++) {
      listener = this.listeners[i]
      listener.onAfterIntegrate && listener.onAfterIntegrate(this)
    }
    if (!this._isIdle) {
      this.looper.run()
    }
  }
loop ( currentTimeMillis ) { let listener if ( this . _lastTimeMillis === - 1 ) { this . _lastTimeMillis = currentTimeMillis - 1 } const ellapsedMillis = currentTimeMillis - this . _lastTimeMillis this . _lastTimeMillis = currentTimeMillis let i = 0 const len = this . listeners . length for ( i = 0 ; i < len ; i ++ ) { listener = this . listeners [ i ] listener . onBeforeIntegrate && listener . onBeforeIntegrate ( this ) } this . advance ( currentTimeMillis , ellapsedMillis ) if ( this . _activeSprings . length === 0 ) { this . _isIdle = true this . _lastTimeMillis = - 1 } for ( i = 0 ; i < len ; i ++ ) { listener = this . listeners [ i ] listener . onAfterIntegrate && listener . onAfterIntegrate ( this ) } if ( ! this . _isIdle ) { this . looper . run ( ) } }
This is the main solver loop called to move the simulation
 forward through time.
This is the main solver loop called to move the simulation forward through time .