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

countOffunction

How many particles of a kind.

Import it

import { countOf } from "@johnmorrisdotca/karakuri/physics";

Definition

function countOf(fluid: Fluid, kind: FluidKind): number

Parameters

NameTypeDescription
fluidFluid

The mutable native particle fluid.

kindFluidKind

The native water, lava or stone particle kind.

Returns

number

How many particles of a kind.

Examples

import { countOf, createFluid, fillRect } from "@johnmorrisdotca/karakuri/physics";

const fluid=createFluid({radius:2,gravity:0,iterations:1,reacts:false});
fillRect(fluid,"water",0,0,8,8);
console.log(countOf(fluid,"water"));
3

What it prints (run when this page was built)

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