Wouldn't it make more logical sense to add canvas to html elements? I.e. checkbox.getContext("2d").fillRect(...)
Imagine being able to declare a list of paths with fill/stroke-paints to draw, filled in from attributes, variables and `calc()` values... one can only dream.
What I really want is something along the lines of...
@declare-some-shape MYSHAPE (ARGS) {
/* tree of draw commands */
/* can reference css animations, timelines, variables, etc. */
}
#my-div { content: draw-some-shape(MYSHAPE ARGS, TRANSFORM); }
/* or, as some kind of pseudo-element: */
#my-div::draw-some-shape(MYSHAPE) { ??? }
And yeah, fully aware that this looks abominable, but I'd rather this than stringly/DOMly generating SVGs or drawing in a canvas.Doing all that is a colossal PITA, since SVGs aren't built to act as "fragments" I can arbitrarely draw with CSS or Canvas.
This new html-in-canvas API will alleviate the pain a bit, at least.
What you described is the CSS painting api (part of CSS Houdini)