ixfx
    Preparing search index...

    Function pendulumForce

    • The pendulum force swings something back and forth.

      // Swinger
      let 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.4
      const 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

      Parameters

      Returns (t: ForceAffected) => ForceAffected