fillRect関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Fills the rectangle from (x, y) to (x + w, y + h) with particles of one kind on a grid a little looser than they settle.
インポート
import { fillRect } from "@johnmorrisdotca/karakuri/physics";
定義
function fillRect(fluid: Fluid, kind: FluidKind, x: number, y: number, w: number, h: number): number
引数
| 名前 | 型 | 説明 |
|---|---|---|
fluid | Fluid | The mutable native particle fluid. |
kind | FluidKind | The native water, lava or stone particle kind. |
x | number | The horizontal coordinate or vector component in native units. |
y | number | The vertical coordinate or vector component in native units. |
w | number | The fill rectangle width in native units. |
h | number | The fill rectangle height in native units. |
戻り値
number
Fills the rectangle from (x, y) to (x + w, y + h) with particles of one kind on a grid a little looser than they settle.
例
import { createFluid, fillRect } from "@johnmorrisdotca/karakuri/physics";
const fluid=createFluid({radius:2,gravity:0,iterations:1,reacts:false});
fillRect(fluid,"water",0,0,8,8);
console.log(fillRect(fluid,"water",10,0,8,8));3出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。