1.0.2 • Published 3 months ago

@jgtools/textmesh v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

TextMesh

npm npm GitHub

TextMesh for ThreeJS that extends Mesh and uses TextGeometry.

Installation

Using npm

npm i @jgtools/textmesh
import TextMesh from "@jgtools/textmesh";
// ...

Using cdn

<script type="module">
    import TextMesh from "https://cdn.jsdelivr.net/npm/@jgtools/textmesh@1.0.0/dist/index.min.js";
    // ...
</script>

Usage

import { FontLoader } from "three/examples/jsm/loaders/FontLoader";
import TextMesh from "@jgtools/textmesh";

const loader = new FontLoader();
const font = await loader.loadAsync("font.json");

const mesh = new TextMesh(font);
mesh.setText("Hello World!");

// use it as a regular Mesh
scene.add(mesh);

// get text as string
const text = mesh.getText();

License

MIT