Apples vector to acceleration, scaling according to mass, based on the mass option. It returns a function which can later be applied to a thing.
vector
mass
import { Forces } from "https://unpkg.com/ixfx/dist/modulation.js"// Acceleration vector of (0.1, 0), ie moving straight on horizontal axisconst f = Forces.accelerationForce({ x:0.1, y:0 }, `dampen`);// Thing to movelet t = { position: ..., acceleration: ... }// Apply forcet = f(t); Copy
import { Forces } from "https://unpkg.com/ixfx/dist/modulation.js"// Acceleration vector of (0.1, 0), ie moving straight on horizontal axisconst f = Forces.accelerationForce({ x:0.1, y:0 }, `dampen`);// Thing to movelet t = { position: ..., acceleration: ... }// Apply forcet = f(t);
Force function
Apples
vector
to acceleration, scaling according to mass, based on themass
option. It returns a function which can later be applied to a thing.