All Projects → bryik → aframe-bmfont-text-component

bryik / aframe-bmfont-text-component

Licence: MIT license
A-Frame component for rendering bitmap fonts.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to aframe-bmfont-text-component

A Mmd
A-Frame MMD component
Stars: ✭ 74 (+19.35%)
Mutual labels:  threejs, aframe
Thehallaframe
WebVR demo that displays art
Stars: ✭ 120 (+93.55%)
Mutual labels:  threejs, aframe
Awesome Aframe
[DISCONTINUED] Collection of awesome resources for the A-Frame WebVR framework.
Stars: ✭ 1,310 (+2012.9%)
Mutual labels:  threejs, aframe
Aframe Forcegraph Component
Force-directed graph component for A-Frame
Stars: ✭ 60 (-3.23%)
Mutual labels:  threejs, aframe
Ar.js
Image tracking, Location Based AR, Marker tracking. All on the Web.
Stars: ✭ 3,048 (+4816.13%)
Mutual labels:  threejs, aframe
Aframe Vimeo Component
Stream Vimeo videos into WebVR.
Stars: ✭ 62 (+0%)
Mutual labels:  threejs, aframe
Webxr Handtracking
👐 WebXR hand tracking examples
Stars: ✭ 116 (+87.1%)
Mutual labels:  threejs, aframe
Aframe Inspector
🔍 Visual inspector tool for A-Frame. Hit *<ctrl> + <alt> + i* on any A-Frame scene.
Stars: ✭ 469 (+656.45%)
Mutual labels:  threejs, aframe
Aframe Effects
A VR Ready Post processing framework for Three.js and/or A-Frame
Stars: ✭ 176 (+183.87%)
Mutual labels:  threejs, aframe
Altspacesdk
Software Development Kit for AltspaceVR
Stars: ✭ 159 (+156.45%)
Mutual labels:  threejs, aframe
Aframe Camera Transform Controls Component
Camera transform controls component for A-Frame
Stars: ✭ 47 (-24.19%)
Mutual labels:  threejs, aframe
a-blast
💥 Save the World From the Cutest Creatures in the Universe!
Stars: ✭ 116 (+87.1%)
Mutual labels:  threejs, aframe
Aframe Extras
Add-ons and helpers for A-Frame VR.
Stars: ✭ 722 (+1064.52%)
Mutual labels:  threejs, aframe
3dstreet
🚲🚶🚌 Web-based 3D visualization of streets using A-Frame
Stars: ✭ 74 (+19.35%)
Mutual labels:  threejs, aframe
A Painter
🎨 Paint in VR in your browser.
Stars: ✭ 539 (+769.35%)
Mutual labels:  threejs, aframe
Three Spritetext
A sprite based text component for ThreeJS
Stars: ✭ 106 (+70.97%)
Mutual labels:  threejs, text
Ideaspace
😎 Create interactive 3D and VR web experiences for desktop, mobile & VR devices
Stars: ✭ 344 (+454.84%)
Mutual labels:  threejs, aframe
Aframe Physics System
Physics system for A-Frame VR, built on CANNON.js.
Stars: ✭ 371 (+498.39%)
Mutual labels:  threejs, aframe
Studio
An authoring platform to build Web Augmented Reality experiences, without coding knowledge
Stars: ✭ 135 (+117.74%)
Mutual labels:  threejs, aframe
Aframe
🅰️ web framework for building virtual reality experiences.
Stars: ✭ 13,428 (+21558.06%)
Mutual labels:  threejs, aframe

This is an old component! A-Frame 0.5.0 and up includes SDF text as a standard component. Use that instead!


aframe-bmfont-text-component

Works with A-Frame version 0.3.0.

This component is useful for rendering bitmap and signed distance field font text in A-Frame. Basically, it wraps Matt DesLauriers' three-bmfont-text and load-bmfont.

screenshot

Properties

Property Description Default Value
text the text you want to appear None
width width of the text box None
align 'left', 'center', 'right' left
letterSpacing the letter spacing in pixels 0
lineHeight the line height in pixels 38
fnt path to 'fnt' file https://...
fntImage path to font image file https://...
mode 'pre' and 'nowrap' 'normal'
color by RGB, hex, or name #000
opacity Extent of transparency. 1.0

More details on these properties here.

Explanation of 'mode' property here.

Usage

Write some text:

<a-entity bmfont-text="text: Hello World;"></a-entity>

To change the size of the text, use the scale component or position the text closer or further away.

Text can be wrapped by specifying width, but I'm not sure what units three-bmfont-text uses. You will have to play around a bit.

Custom Fonts

A guide for generating SDF fonts can be found here; here is an example comparing Arial Black and DejaVu. Bitmap fonts also work, but do not look nearly as good.

Different fonts can be specified with the 'fnt' and 'fntImage' properties.

<a-entity bmfont-text="text: Hello World; fnt:../fonts/DejaVu-sdf.fnt; fntImage:../fonts/DejaVu-sdf.png">
</a-entity>

Thanks to jsDelivr, these default to hosted "DejaVu-sdf.fnt" and "DejaVu-sdf.png" files.

Limitations

This component does not make use of all of the features of three-bmfont-text and its sister modules, if you require more advanced functionality such as tabSize and start and end indices, I recommend forking this component and modifying it. Pull requests are welcome, but please include a test example.

Bitmap font rendering limits you to the characters included in the font (Unicode this is not). SDF font (in particular) tends to smooth sharp edges though there are ways around this.

Additional Information

If you are interested in text rendering in WebGL/ThreeJS/A-Frame and want to learn more, I recommend reading the documentation for three-bmfont-text.

Here are some additional resources:

Installation

Browser

Install and use by directly including the browser files:

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.3.0/aframe.min.js"></script>
  <script src="https://cdn.jsdelivr.net/gh/bryik/aframe-bmfont-text-component@e041ead91a309c924408087a0f7aef0cb870e2f9/dist/aframe-bmfont-text-component.min.js"></script>
</head>

<body>
  <a-scene>
    <a-entity bmfont-text="text: Hello world"></a-entity>
  </a-scene>
</body>

NPM

Install via NPM:

npm install aframe-bmfont-text-component

Then register and use.

require('aframe');
require('aframe-bmfont-text-component');
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].