How add backgroudcolor to DynamicTexture? is there the possibility of adding background color?
My initial example:
https://www.babylonjs-playground.com/#8NZY7M#1
How add backgroudcolor to DynamicTexture? is there the possibility of adding background color?
My initial example:
https://www.babylonjs-playground.com/#8NZY7M#1
Hi @Dieterich
Just add clearColor
https://www.babylonjs-playground.com/#8NZY7M#2
texturaInfoObjeto.drawText(txt, null, 140, 'bold 80px arial', 'yellow', 'black')
@aWeirdo thanks! that’s easter egg, so hidden…
Taking advantage of the question, how can I make a line break?
Afraid drawText doesn’t support linebreaks as far as i know.
But you can do it in many ways.
One simple example, keeping lines as multiple strings in an object.
https://www.babylonjs-playground.com/#8NZY7M#3
if(typeof txt === "object"){
for(var i = 0; i < txt.length; i++){
texturaInfoObjeto.drawText(txt[i], null, 100 + (fontSize * i), 'bold '+fontSize+'px arial', 'yellow', (i === 0 ? 'black' : null) )
}
}
else {
texturaInfoObjeto.drawText(txt, null, 100, 'bold '+fontSize+'px arial', 'yellow', 'black')
}
Wooww that’s so helpful!
Last question , can be possible align the text in vertical?
thanks!
Perhaps you should use GUI if you think about using complex texts
GUI is based on a texture that you can easily reuse and provide the TextBlock control that has all that you need
@Deltakosh well remembered! thanks!