How to use the babylonjs-gui.Image function in babylonjs-gui

To help you get started, we’ve selected a few babylonjs-gui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brianzinn / react-babylonjs / src / Button3D.ts View on Github external
create(scene: Scene): BabylonButton3D {
    this.button3D = new BabylonButton3D(this.props.name)

    // console.log("created button", this.props.name)

    let text: TextBlock | undefined = undefined
    let image: BabylonImage | undefined = undefined

    if (this.props.imageUrl) {
      image = new BabylonImage(`${this.props.name}-image`, this.props.imageUrl)
    }

    if (this.props.text) {
      text = new TextBlock()

      text.text = this.props.text
      if (this.props.fontColor) {
        text.color = this.props.fontColor.toHexString()
      } else {
        text.color = "white" // default in BabylonJS
      }

      if (this.props.fontSize) {
        text.fontSize = this.props.fontSize
      } else {
        text.fontSize = 24 // default in BabylonJS