BabylonJS: Dynamic Texture

The syntax to create Dynamic Texture:

var myDynamicTexture = new BABYLON.DynamicTexture(name, option, scene);

The required parameters to create Dynamic texture:

  • name − name of the dynamic texture
  • option − will have the width and height of the dynamic texture
  • scene − scene created

The syntax to write text on the texture

myDynamicTexture.drawText(text, x, y, font, color, canvas color, invertY, update);

The required parameters to write text on the texture

  • text − text to be written;
  • x − distance from the left-hand edge;
  • y − distance from the top or bottom edge, depending on invertY;
  • font − font definition in the form font-style, font-size, font_name;
  • invertY − true by default in which case y is the distance from the top when false, y is the distance from the bottom and the letters reversed;
  • update − true by default, the dynamic texture will immediately be updated.

Leave a Reply

Your email address will not be published. Required fields are marked *