WHS.Text
class is made for creating 3D text objects.
Physics text object can be convex or concave. By default it's convex
but you can also switch to concave.
const text = new WHS.Text({
geometry: {
text: 'hello world',
parameters: {
font: 'assets/fonts/gentilis_bold.typeface.js',
size: 20,
height: 5,
curveSegments: 6
}
},
material: new THREE.MeshBasicMaterial({
color: 0xffffff
}),
position: {
x: -40,
y: 20,
z: 0
}
});
text.addTo(world);
Parameters
Geometry defaults
{
// ...
geometry: {
text: 'Hello World!', // String.
parameters: { // Object.
size: 12,
height: 50,
curveSegments: 12,
font: new THREE.Font(),
bevelEnabled: false,
bevelThickness: 10,
bevelSize: 8
}
}
}
These defaults are additional, there are also defaults filled by
MeshComponent
, etc.
Instructions
{
// ...
geometry: ['text', 'parameters']
}
Updated over 7 years ago