Reference · Deterministic 2D physics
Particletype
One particle.
Import it
import type { Particle } from "@johnmorrisdotca/karakuri/physics";
Definition
interface Particle {
x: number;
y: number;
px: number;
py: number;
kind: FluidKind;
}
Members
| Name | Type | Description |
|---|---|---|
x | number | |
y | number | |
px | number | |
py | number | |
kind | FluidKind |
Examples
import { createFluid, fillRect } from "@johnmorrisdotca/karakuri/physics";
import type { Particle } from "@johnmorrisdotca/karakuri/physics";
const fluid=createFluid({radius:2,gravity:0,iterations:1,reacts:false});
fillRect(fluid,"water",0,0,8,8);
const value: Particle = fluid.particles[0];
console.log(value);{ x: 2, y: 2, px: 2, py: 2, kind: 'water' }What it prints (run when this page was built)