/** implicit euler spring */ class SpringBase { oscPerSec = Math . PI * 2 ; damping = 1 ; epsilon = 0.01 ; setTarget ( v ) { console . log ( "SET_TARGET NOT IMPLEMENTED" ) ; return this ; } setOscPerSec ( sec ) { this . oscPerSec = Math . PI * 2 * sec ; return this ; } setDamp ( damping ) { this . damping = damping ; return this ; } /** Damp Time, in seconds to damp. So damp 0.5 for every 2 seconds.
    With the idea that for every 2 seconds, about 0.5 damping has been applied */ setDampRatio ( damping , dampTime ) { this . damping = Math . log ( damping ) / ( - this . oscPerSec * dampTime ) ; return this ; } /** Reduce oscillation by half in X amount of seconds */ setDampHalfLife ( dampTime ) { this . damping = 0.6931472 / ( this . oscPerSec * dampTime ) ; return this ; } setDampExpo ( dampTime ) { this . oscPerSec = 0.6931472 / dampTime ; this . damping = 1 ; return this ; } reset ( v ) { return this ; } update ( dt ) { console . log ( "UPDATE NOT IMPLEMENTED" ) ; return false ; } } export default SpringBase ;