1.0.1 • Published 8 years ago

aframe-textwrap-component v1.0.1

Weekly downloads
Last release
8 years ago

AFrame Text Wrap Component

Wrappable text as a material for an A-Frame VR entity. Requires draw.


All attributes are listed below.


npm i aframe-draw-component --save
npm i aframe-textwrap-component --save


Register the component with AFrame:

var AFRAME = require("aframe-core");
var draw = require("aframe-draw-component").component;
var textwrap = require("aframe-textwrap-component").component;
AFRAME.registerComponent("draw", draw);
AFRAME.registerComponent("textwrap", textwrap);

Then integrate it on an entity:

<a-entity id="box" geometry="primitive: box" position="0 2 0" draw="background: #D7E8FF" textwrap="textAlign: center; x: 128; y: 128; text: Hello world!"></a-entity>


All properties have a default! :)

textthe text that should be wrapped. If your text contains a colon (:) or a semicolon (;), you can escape it using url(my:text;).
xcanvas x position of the text (upper left corner)
ycanvas y position of the text (upper left corner)
fontcss font string (see here)
colorcolor of the text
textAligntext alignment (see here)
textBaselinetext baseline (see here)
directiontext direction (see here)
widthwidth of text block in pixels
lineHeightline height (vertical spacing) in pixels

##Additional Info

  • Wrapping function is from here.