UNPKG

pocket-physics

Version:

Verlet physics extracted from pocket-ces demos

8 lines (7 loc) 219 B
import { set } from "./v2"; export const inertia = (cmp) => { const x = cmp.cpos.x * 2 - cmp.ppos.x; const y = cmp.cpos.y * 2 - cmp.ppos.y; set(cmp.ppos, cmp.cpos.x, cmp.cpos.y); set(cmp.cpos, x, y); };