Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jgtools/textmesh

TextMesh for ThreeJS
https://github.com/jgtools/textmesh

javascript jgtools text-geometry text-mesh threejs typescript

Last synced: 3 months ago
JSON representation

TextMesh for ThreeJS

Awesome Lists containing this project

README

        

# TextMesh

[![npm](https://img.shields.io/npm/v/@jgtools/textmesh)](https://www.npmjs.com/package/@jgtools/textmesh)
[![npm](https://img.shields.io/npm/dm/@jgtools/textmesh)](https://www.npmjs.com/package/@jgtools/textmesh)
[![GitHub](https://img.shields.io/github/license/jgtools/textmesh)](https://github.com/git/git-scm.com/blob/main/MIT-LICENSE.txt)

TextMesh for ThreeJS that extends Mesh and uses TextGeometry.

## Installation

### Using npm

```bash
npm i @jgtools/textmesh
```

```javascript
import TextMesh from "@jgtools/textmesh";
// ...
```

### Using cdn

```html

import TextMesh from "https://cdn.jsdelivr.net/npm/@jgtools/[email protected]/dist/index.min.js";
// ...

```

## Usage

```javascript
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