Single div Sierpinski triangle
yuanchuan.dev
yuanchuan.dev
I was visiting a 20th century art gallery and was joking with my friends about which painters could be implemented in CSS (Yves Klein ofc). Maybe I should go ahead and do it. There's a few Mondrians that'd be fairly easy.
Although I guess if you have an arbitrary number of divs, CSS just becomes a much more esoteric equivalent to SVG
Of course, if you're OK with multiple divs, the ultimate extension is to just make a giant rectangular grid of 1x1 pixel divs and color them appropriately.
https://recursivebuttons.mcalus.dev/
i love all kinds of fractal generative art :)
Web is awesome, and browsers are the most advanced tech! But it seems to be hard to draw flipping triangles at fixed coordinates. Maybe that could be fixed with e.g. a special planar geometry library that makes precise calculations. Like 500x3.125%==15.625 and not 27.
Sub-pixel rendering is often nice, but when you actually want a simple monochrome diagonal line filling only whole pixels on purpose (because, e.g., you don't want your intended 1-pixel wide black line to become a two-pixel wide gray line, or you're simply making something pixel-arty), the only reliable portable way to do it is to implement bresenham and draw it pixel by pixel yourself...
The standard methods on a canvas that are supposed to make a non-smooth line, such as using exact pixel centers (shift 0.5) and width 1, work in some browsers, not in others, not for some angles of the line, and sometimes it even depends on the width and height in pixels of the canvas whether it'll look smooth or sharp, even for the exact same absolute coordinates of the line.