Drawing an ellipse inside a DynamicTexture

Hi,

I would like to draw a filled ellipse inside a DynamicTexture and I was wondering how to it in a proper way, I’m playing around with quadraticCurveTo, but I cannot get it perfectly right.

Thank you

1 Like

Biggest recommendation I would say is using the Babylon GUI!

You can create for mesh using BABYLON.GUI.AdvancedDynamicTexture.CreateForMesh() and then just add an eclipse on it and change the color to whatever you’d like.

1 Like

MoveTo a × cos(0), b × sin(0)

for (angle = delta; angle < 2 × PI; angle += delta)
LineTo a × cos(angle), b × sin(angle)

1 Like

You can easily reuse the 2d context from the dynamic texture so then you can do anything allowed by CanvasRenderingContext2D.ellipse() - Web APIs | MDN

https://playground.babylonjs.com/#5ZCGRM#2000

3 Likes