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

RigNodetype

A point of a chain. invMass 0 pins it. r above 0 makes it a disc that rests on the rig's statics.

Import it

import type { RigNode } from "@johnmorrisdotca/karakuri/physics";

Definition

interface RigNode {
    x: number;
    y: number;
    px: number;
    py: number;
    invMass: number;
    r: number;
}

Members

NameTypeDescription
xnumber
ynumber
pxnumber
pynumber
invMassnumber
rnumber

Examples

import { addRope, createRig } from "@johnmorrisdotca/karakuri/physics";
import type { RigNode } from "@johnmorrisdotca/karakuri/physics";

const rig=createRig({gravity:0,iterations:1});
addRope(rig,0,0,10,0,2);
const value: RigNode = rig.nodes[0];
console.log(value);
{ x: 0, y: 0, px: 0, py: 0, invMass: 0, r: 0 }

What it prints (run when this page was built)

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