How to draw a canvas element on screen using Phaser 3?

See the following StackOverflow question: https://stackoverflow.com/questions/54964242/how-to-draw-a-canvas-element-using-phaser-3

Thank you.

See textures/create canvas.

createCanvas() return texture, then you draw to texture.context.

Samme,

Thanks for your reply. However, I’m not following that example. To clarify, I don’t want to draw to the texture’s context. I want to use an existing canvas object that I have already created. So that example doesn’t apply, correct me if I am wrong.

You can try DOM game object, but it is not available in the lastest (3.16.2) version, only worked in dev version now.

const circleTexture = this.textures.addCanvas('circle', circle);

@samme Thank you!!! That worked. I’ll update the StackOver flow answer too.