I am making 3D text using WebGL , three.js and THREE.TextGeometry . While this is working. I can create one line of 3D text.
Now I want to create multi-line text as a short paragraph. Preferably, I would like it to naturally turn around when it reaches the border of the field / rectangle in which it is placed. I need a similar behavior that standard HTML text has when it is inside a div, wrapping it in multiple lines when it reaches the edge of its parent div.
This is how I create one line:
textGeo = new THREE.TextGeometry( 'Hello there. Am I a paragraph? I hope so.', 'size': 30 'height': 2 'font': 'helvetiker' 'weight': 'normal' 'style': 'normal' bevelThickness: 0.1 bevelSize: 0 bevelEnabled: true material: 0 extrudeMaterial: 1 ) materialArray = [ new THREE.MeshBasicMaterial( { color: 0xFFFFFF } ) new THREE.MeshBasicMaterial( { color: 0x666666, shading: THREE.SmoothShading } ) ] textMaterial = new THREE.MeshFaceMaterial(materialArray) textGeo = new THREE.Mesh(textGeo, textMaterial) textGeo.position.x = -150 textGeo.rotation.y = de2ra(15) scene.add textGeo
How can I do this multi-line? Also, how can I put this inside a square so that it wraps around? How to create a square?
zakdances
source share