Skip to the content

Karakuriからくり

Play eight native puzzles, run bounded searches, step deterministic physics and mount a canvas player controlled by pointer or keyboard.

Karakuri is the Japanese word からくり for a mechanism or ingenious device. About the name

Contents

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

NameTypeDescription
xnumber
ynumber
pxnumber
pynumber
kindFluidKind

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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/karakuri 0.2.1.