addNode関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Adds a node and gives back its index.
インポート
import { addNode } from "@johnmorrisdotca/karakuri/physics";
定義
function addNode(rig: Rig, x: number, y: number, invMass: number, r?: number): number
引数
| 名前 | 型 | 説明 |
|---|---|---|
rig | Rig | The mutable native rope nodes, constraints and static geometry. |
x | number | The horizontal coordinate or vector component in native units. |
y | number | The vertical coordinate or vector component in native units. |
invMass | number | Inverse mass; zero anchors the node. |
r (省略可) | number | The native node radius. |
戻り値
number
Adds a node and gives back its index.
例
import { addNode, addRope, createRig } from "@johnmorrisdotca/karakuri/physics";
const rig=createRig({gravity:0,iterations:1});
addRope(rig,0,0,10,0,2);
console.log(addNode(rig,12,0,1,2));3出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。