• Stars
    star
    306
  • Rank 133,516 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 6 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A sprite based text component for ThreeJS

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

Property Description Default
text The text to be displayed on the sprite. Supports center aligned multi-lines, using the \n character to define line breaks.
textHeight The height of the text. 10
color The fill color of the text. white
backgroundColor The canvas background color. A falsy value makes the canvas transparent. false
strokeWidth The width of the text stroke, proportional to the text size. A value of 0 disables stroking. 0
strokeColor The color of the text stroke. white
fontFace The font type of the text. Arial
fontSize The 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
fontWeight The weight (or boldness) of the font. The weights available depend on the font-family you are using. normal
padding The 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
borderWidth The size of the border around the canvas. Supports either single values, or a tuple with two values representing horizontal and vertical border size. 0
borderRadius The 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
borderColor The 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 β˜•!

More Repositories

1

3d-force-graph

3D force-directed graph component using ThreeJS/WebGL
HTML
4,252
star
2

react-force-graph

React component for 2D, 3D, VR and AR force directed graphs
HTML
1,861
star
3

globe.gl

UI component for Globe Data Visualization using ThreeJS/WebGL
HTML
1,809
star
4

force-graph

Force-directed graph rendered on HTML5 canvas
JavaScript
1,409
star
5

three-globe

WebGL Globe Data Visualization as a ThreeJS reusable 3D object
JavaScript
1,071
star
6

react-globe.gl

React component for Globe Data Visualization using ThreeJS/WebGL
HTML
775
star
7

timelines-chart

Timelines Chart
JavaScript
527
star
8

sunburst-chart

A sunburst interactive chart web component for visualizing hierarchical data
JavaScript
273
star
9

three-forcegraph

Force-directed graph as a ThreeJS 3d object
JavaScript
219
star
10

3d-force-graph-vr

3D force-directed graph component in VR
HTML
208
star
11

d3-force-registry

A curated compilation of plugins and all-things related to d3-force
133
star
12

3d-force-graph-ar

3D force-directed graph component in AR
HTML
87
star
13

aframe-forcegraph-component

Force-directed graph component for A-Frame
JavaScript
77
star
14

three-fatline

A ThreeJS Line object with variable width
JavaScript
68
star
15

circlepack-chart

A circle packing interactive chart web component for visualizing hierarchical data
JavaScript
55
star
16

kapsule

Kapsule - A closure based Web Component library
JavaScript
54
star
17

treemap-chart

A treemap interactive chart web component for visualizing hierarchical data
JavaScript
54
star
18

three-geojson-geometry

ThreeJS geometry to stroke GeoJSON objects on a sphere
JavaScript
52
star
19

globe-ar

3D Globe data visualization component in AR
HTML
51
star
20

three-render-objects

Easy way to render ThreeJS objects with built-in interaction defaults
JavaScript
45
star
21

horizon-timeseries-chart

A chart to represent time-series data using multiple vertically layered horizon area plots
JavaScript
44
star
22

three-conic-polygon-geometry

ThreeJS geometry for drawing polygons on a sphere
JavaScript
36
star
23

canvas-color-tracker

A utility to track objects on a canvas by unique px color
HTML
34
star
24

icicle-chart

A partition / icicle interactive chart web component for visualizing hierarchical data
JavaScript
33
star
25

d3-geo-zoom

Zoom and pan D3 geo projections
JavaScript
30
star
26

aframe-globe-component

3D Globe data visualization component for A-Frame
JavaScript
30
star
27

d3-force-magnetic

A natural attraction/repulsion force type for the d3-force simulation engine
JavaScript
27
star
28

hilbert-chart

Hilbert space-filling curve chart
JavaScript
27
star
29

d3-radial-axis

A radial implementation of the D3 axis component
JavaScript
25
star
30

ip.js

A JS library for manipulating IP addresses, prefixes and ranges
JavaScript
23
star
31

d3-hilbert

D3 layout to visualize distance variables using a continuous Hilbert space-filling curve.
JavaScript
22
star
32

d3-force-surface

A multi-surface elastic collision force type for the d3-force simulation engine
JavaScript
21
star
33

cartogram-chart

A cartogram chart web component for visualizing geographical data by distorting a TopoJson topology
JavaScript
19
star
34

d3-force-bounce

An elastic collision force type for the d3-force simulation engine
JavaScript
16
star
35

d3-morton-order

D3 layout to visualize distance variables using a continuous Morton (Z-order) space-filling curve.
JavaScript
11
star
36

d3-force-cluster-3d

A clustering force type for the d3-force-3d simulation engine
JavaScript
10
star
37

d3-binarytree

One-dimensional recursive spatial subdivision.
JavaScript
9
star
38

d3-horizon

Horizon area chart D3 component
JavaScript
8
star
39

proportions-chart

A one-dimensional proportional chart web component for visualizing categorical data
JavaScript
8
star
40

d3-force-limit

A positioning hard limit force type for the d3-force simulation engine
JavaScript
8
star
41

index-array-by

A utility function to index arrays by any criteria
JavaScript
8
star
42

react-kapsule

React wrapper for kapsule-style web components
JavaScript
8
star
43

multilateration

Locate points according to distributed beacon signals with consistent propagation speeds
JavaScript
6
star
44

data-joint

Perform data joins with any type of JS objects
JavaScript
6
star
45

Intermap

Internet Interactive Map
JavaScript
6
star
46

d3-zoomable

Easy way to apply d3-zoom functionality to DOM elements
JavaScript
6
star
47

d3-force-pod

Component to automatically draw nodes/links in a D3 force simulation according to a set of forces
JavaScript
5
star
48

accessor-fn

A wrapper function for object accessor properties
JavaScript
5
star
49

d3-color-legend

SVG color legends for continuous or discrete D3 scales
JavaScript
3
star
50

d3-force-constant

A constant acceleration force type for the d3-force simulation engine
JavaScript
3
star
51

svg-text-fit

SVG utility for fitting text inside a box by resizing or ellipsis
JavaScript
3
star
52

jerrypick

Pluck and omit properties from a JS object
JavaScript
3
star
53

ui-module

Template repo for UI modules
JavaScript
2
star
54

three-trackballcontrols-web

A browser friendly wrapper of https://github.com/JonLim/three-trackballcontrols
JavaScript
2
star
55

svg-utils

Miscellaneous utility components for manipulating SVG
JavaScript
2
star
56

forcelayout3d-web

A browser friendly wrapper of https://github.com/anvaka/ngraph.forcelayout3d
JavaScript
1
star
57

js-module

Template repo for JS modules
JavaScript
1
star
58

ris-live-viz

A quick RIS live viz prototype
JavaScript
1
star
59

flatten

Recursively flatten nested arrays with arbitrary levels
JavaScript
1
star
60

scroll-zoom-clamp

Prevent page scrolling interference by zooming components
JavaScript
1
star