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

nodeSpeedfunction

The speed of a node in units a second at a step of dt.

Import it

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

Definition

function nodeSpeed(n: RigNode, dt: number): number

Parameters

NameTypeDescription
nRigNode

The native rope node whose displacement is measured.

dtnumber

Elapsed simulated seconds; use STEP for the package’s fixed-step convention.

Returns

number

The speed of a node in units a second at a step of dt.

Examples

import { STEP, addRope, createRig, nodeSpeed } from "@johnmorrisdotca/karakuri/physics";

const rig=createRig({gravity:0,iterations:1});
addRope(rig,0,0,10,0,2);
console.log(nodeSpeed(rig.nodes[0],STEP));
0

What it prints (run when this page was built)

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