本文へ移動

Fuda Cards札

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

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

目次

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

createLiveCards関数

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

Make the live cards of a page. Nothing 3D is loaded until a card is first in focus (or a card with no picture of its own comes near the view and needs its still made).

インポート

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

定義

function createLiveCards<T extends ThreeLike = ThreeLike>(options: LiveCardsOptions<T>): LiveCards<T>

引数

名前型説明
optionsLiveCardsOptions<T>

How to load three.js (load), and optionally the turn, the dwell and the look-ahead; see LiveCardsOptions.

戻り値

LiveCards<T>

The live cards; call add for each card, and dispose when the page is done with them.

例

import { createLiveCards } from "@johnmorrisdotca/fuda-cards/live-3d";
import { PerspectiveCamera, Scene } from "three";

const live = createLiveCards({ load: () => import("three") });
const card = document.querySelector("fuda-card") as HTMLElement;
const remove = live.add(card, {
  key: "cube",
  build: () => ({ scene: new Scene(), camera: new PerspectiveCamera(40, 1, 0.1, 10) }),
});
remove();

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

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