@jgtools/textmesh
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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

Package Sidebar

Install

npm i @jgtools/textmesh

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

5.46 kB

Total Files

5

Last publish

Collaborators

  • eekelof