createLiveCardsfunction
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 it
import { createLiveCards } from "@johnmorrisdotca/fuda-cards/live-3d";
Definition
function createLiveCards<T extends ThreeLike = ThreeLike>(options: LiveCardsOptions<T>): LiveCards<T>
Parameters
| Name | Type | Description |
|---|---|---|
options | LiveCardsOptions<T> | How to load three.js ( |
Returns
LiveCards<T>
The live cards; call add for each card, and dispose when the page is done with them.
Examples
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();