Spring force
// End of spring that moveslet thing = { position: { x: 1, y: 0.5 }, mass: 0.1};// Anchored other end of springconst pinnedAt = {x: 0.5, y: 0.5};// Create force: length of 0.4const springForce = Forces.springForce(pinnedAt, 0.4);continuously(() => {// Apply forcething = Forces.apply(thing, springForce);}).start(); Copy
// End of spring that moveslet thing = { position: { x: 1, y: 0.5 }, mass: 0.1};// Anchored other end of springconst pinnedAt = {x: 0.5, y: 0.5};// Create force: length of 0.4const springForce = Forces.springForce(pinnedAt, 0.4);continuously(() => {// Apply forcething = Forces.apply(thing, springForce);}).start();
Read more
Anchored end of the spring
Length of spring-at-rest (default: 0.5)
Spring stiffness (default: 0.0002)
Damping factor to apply, so spring slows over time. (default: 0.995)
ForceAffected
Spring force
Read more