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

capsulesAlongfunction

A capsule chain for a drawn line: one capsule between each pair of neighbouring points.

Import it

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

Definition

function capsulesAlong(points: readonly { x: number; y: number; }[], radius: number): CapsuleShape[]

Parameters

NameTypeDescription
pointsreadonly { x: number; y: number; }[]

Ordered native points forming a polyline.

radiusnumber

The capsule radius in native world units.

Returns

CapsuleShape[]

A capsule chain for a drawn line: one capsule between each pair of neighbouring points.

Examples

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

console.log(capsulesAlong([{x:0,y:0},{x:10,y:0}],2));
[ { kind: 'capsule', ax: 0, ay: 0, bx: 10, by: 0, r: 2 } ]

What it prints (run when this page was built)

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