Cogent Core Docs

0%

Loading...

Static preview:

Canvas

A canvas is a widget that allows you to manually render anything. All canvas coordinates are on a normalized 0-1 scale.

If you want to render SVG files, use an SVG widget instead. For images, use an image widget. For videos, use a video widget. For HTML, see HTML.

Draw

You can set the function used to draw a canvas:

You can draw lines:

You can change the width of lines:

You can draw circles:

You can combine any number of canvas rendering operations:

You can animate a canvas (see that page for more information):

You can draw ellipses:

You can draw elliptical arcs:

You can draw regular polygons:

You can draw quadratic arcs:

You can draw cubic arcs:

Styles

You can change the size of a canvas:

You can make a canvas grow to fill the available space: