PaintWorklet

You can create a CSS image programmatically using the same syntax you use to draw on the canvas.

See the Pen Untitled by Web Coding Center (@webcodingcenter)on CodePen.