[HN Gopher] CSS Painting API
       ___________________________________________________________________
        
       CSS Painting API
        
       Author : 90s_dev
       Score  : 20 points
       Date   : 2025-05-26 20:59 UTC (2 hours ago)
        
 (HTM) web link (developer.mozilla.org)
 (TXT) w3m dump (developer.mozilla.org)
        
       | 90s_dev wrote:
       | We came full circle. We started out overriding draw(), then HTML
       | + CSS took over, and now we're back to overriding draw(). This
       | was a huge inspiration for 90s.dev
        
       | paulryanrogers wrote:
       | Why? Nothing in that article makes the use case clear. Perhaps I
       | just lack imagination?
        
         | 90s_dev wrote:
         | Near the top:
         | 
         | > to set complex custom backgrounds on an element
         | 
         | Basically the same reasons you might need draw() in traditional
         | GUIs.
         | 
         | Do this in CSS:
         | https://camo.githubusercontent.com/b6c45f60f6e450574c4087589...
         | 
         | (image taken from the other guy's comment's gh repo)
        
         | dwoldrich wrote:
         | Reusable dynamic canvas code as background image? -\\_(tsu)_/-
         | 
         | https://developer.mozilla.org/en-US/docs/Web/API/CSS_Paintin...
        
       | jauco wrote:
       | The most fun I had with this was to make initial versions of apps
       | look alpha using https://github.com/pshihn/rough-paint
        
         | 90s_dev wrote:
         | Amazing example and show-case, great job. Reminded me of my
         | pinstripes:
         | 
         | https://os.90s.dev/#sys/apps/paint.app.js
         | 
         | https://github.com/sdegutis/os.90s.dev/blob/31bf4ec46e02367b...
         | 
         | But yours is much fancier and cooler.
        
       | hyperhello wrote:
       | But you can do this now with Canvas.toDataURL(). Do we need to
       | support another drawing surface API?
        
         | 90s_dev wrote:
         | Using toDataURL() has a lot of overhead that this doesn't use.
         | Also this runs in worklets.
        
       ___________________________________________________________________
       (page generated 2025-05-26 23:00 UTC)