New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

three-spritetext

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

three-spritetext

A sprite based text component for ThreeJS


Version published
Weekly downloads
13K
increased by2.11%
Maintainers
1
Weekly downloads
 
Created

three-spritetext

NPM package Build Size Dependencies

A sprite based text component for ThreeJS. The text is drawn to canvas, converted into a Texture and then used as a material on a Sprite. Because a sprite is being used, the text will always face the camera, and have its orientation fixed relative to the camera.

Quick start

import SpriteText from 'three-spritetext';

or

var SpriteText = require('three-spritetext');

or even

<script src="//unpkg.com/three-spritetext"></script>

then

var myText = new SpriteText('My text');

var myScene = new THREE.Scene();
myScene.add(myText);

API reference

Constructor

SpriteText ([text, textHeight, color])

Properties

PropertyDescriptionDefault
textThe text to be displayed on the sprite. Supports center aligned multi-lines, using the \n character to define line breaks.
textHeightThe height of the text.10
colorThe color of the text.white
fontFaceThe font type of the text.Arial
fontSizeThe resolution of the text, in terms of vertical number of pixels. Lower values may cause text to look blurry. Higher values will yield sharper text, at the cost of performance.90
fontWeightThe weight (or boldness) of the font. The weights available depend on the font-family you are using.normal

Giving Back

paypal If this project has helped you and you'd like to contribute back, you can always buy me a ☕!

FAQs

Package last updated on 18 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts