LiveItem型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What a card shows in 3D: a key (items with the same key share their pictures) and a scene made from shared assets (assets.acquire).
インポート
import type { LiveItem } from "@johnmorrisdotca/fuda-cards/live-3d";
定義
interface LiveItem<T extends ThreeLike = ThreeLike> {
key: string;
build(context: BuildContext<T>): LiveScene | Promise<LiveScene>;
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
key | string | |
build | (context: BuildContext<T>): LiveScene | Promise<LiveScene> |
例
import type { LiveItem } from "@johnmorrisdotca/fuda-cards/live-3d";
import { BoxGeometry, Mesh, MeshNormalMaterial, PerspectiveCamera, Scene } from "three";
const cube: LiveItem = {
key: "cube",
build() {
const object = new Mesh(new BoxGeometry(1, 1, 1), new MeshNormalMaterial());
return { scene: new Scene().add(object), camera: new PerspectiveCamera(40, 1, 0.1, 10), object };
},
};
console.log(cube.key);この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。