Skip to content

JGTools/TextMesh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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