Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

three-spritetext

Package Overview
Dependencies
Maintainers
0
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

three-spritetext

A sprite based text component for ThreeJS

  • 1.9.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14K
increased by12.19%
Maintainers
0
Weekly downloads
 
Created
Source

three-spritetext

NPM package Build Size NPM Downloads

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 has its orientation fixed relative to the camera.

Quick start

import SpriteText from 'three-spritetext';

or using a script tag

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

then

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

const 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 fill color of the text.white
backgroundColorThe canvas background color. A falsy value makes the canvas transparent.false
strokeWidthThe width of the text stroke, proportional to the text size. A value of 0 disables stroking.0
strokeColorThe color of the text stroke.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
paddingThe amount of padding between the text and the canvas edge. Supports either single values, or a tuple with two values representing horizontal and vertical padding.0
borderWidthThe size of the border around the canvas. Supports either single values, or a tuple with two values representing horizontal and vertical border size.0
borderRadiusThe corner radius of the border. Supports either single values, or an array of four values representing the four corners in order: top-left, top-right, bottom-right, bottom-left.0
borderColorThe color of the border.white

Giving Back

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

Keywords

FAQs

Package last updated on 06 Dec 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc