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

fluidNumbersfunction

Every number of the liquid's particles, for hashing it (kinds as 0, 1, 2).

Import it

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

Definition

function fluidNumbers(fluid: Fluid): number[]

Parameters

NameTypeDescription
fluidFluid

The mutable native particle fluid.

Returns

number[]

Every number of the liquid's particles, for hashing it (kinds as 0, 1, 2).

Examples

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

const fluid=createFluid({radius:2,gravity:0,iterations:1,reacts:false});
fillRect(fluid,"water",0,0,8,8);
console.log(fluidNumbers(fluid));
[
     2,   2,    2,   2, 0,
   6.1,   2,  6.1,   2, 0,
  4.05, 6.1, 4.05, 6.1, 0
]

What it prints (run when this page was built)

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