The pendulum force swings something back and forth.
// Swingerlet thing = { position: { x: 1, y: 0.5 }, mass: 0.1};// Position thing swings from (middle of screen)const pinnedAt = {x: 0.5, y: 0.5};// Create force: length of 0.4const pendulumForce = Forces.pendulumForce(pinnedAt, { length: 0.4 });continuously(() => { // Apply force // Returns a new thing with recalculated angularVelocity, angle and position. thing = Forces.apply(thing, pendulumForce);}).start(); Copy
// Swingerlet thing = { position: { x: 1, y: 0.5 }, mass: 0.1};// Position thing swings from (middle of screen)const pinnedAt = {x: 0.5, y: 0.5};// Create force: length of 0.4const pendulumForce = Forces.pendulumForce(pinnedAt, { length: 0.4 });continuously(() => { // Apply force // Returns a new thing with recalculated angularVelocity, angle and position. thing = Forces.apply(thing, pendulumForce);}).start();
Read more
Optional
Location to swing from (x:0.5, y:0.5 default)
Options
The pendulum force swings something back and forth.
Read more