本文へ移動

Fuda Cards札

画像やライブ3Dを入れるコレクション用のカード枠です。本物の厚み、縁、箔、山、傷み、バインダーを、2つのWebコンポーネントで使えます。

「札(ふだ)」は、カードや札を指す日本語です。 名前について(英語)

目次

リファレンス · カードの中のライブ3D

LiveScene型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

A scene for a card: kazoku-ui's scene, with object, the thing that turns about its upright axis while the card is in focus.

インポート

import type { LiveScene } from "@johnmorrisdotca/fuda-cards/live-3d";

定義

interface LiveScene extends Scene3D {
    object?: {
        rotation: {
            y: number;
        };
    };
}

メンバー

名前型説明
object (省略可){ rotation: { y: number; }; } | undefined
sceneunknown
cameraunknown
update (省略可)((dt: number, now: number) => boolean | void) | undefined

Called before each draw while the view is live. Return true while something is moving; the view is then drawn again next frame, else it rests.

resize (省略可)((width: number, height: number) => void) | undefined

The view's size in CSS pixels changed (set the camera's aspect).

dispose (省略可)(() => void) | undefined

Free what only this scene owns. Shared assets are freed by the cache.

例

import type { LiveScene } from "@johnmorrisdotca/fuda-cards/live-3d";
import { BoxGeometry, Mesh, MeshNormalMaterial, PerspectiveCamera, Scene } from "three";

const cube = new Mesh(new BoxGeometry(1, 1, 1), new MeshNormalMaterial());
const scene = new Scene().add(cube);
const live: LiveScene = { scene, camera: new PerspectiveCamera(40, 1, 0.1, 10), object: cube };
console.log(live.object === cube);

ソースを見るGitHub で編集@johnmorrisdotca/fuda-cards 0.11.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。