This is a canvas compatible api where I used the WebIDL for the CanvasRendering2d module from Firefox/Safari and converted all its functions from camelCase to snake_case and attributes to setter functions. Allowing you to write elixir and get out art or animations or charts on a canvas. Initially this was just going to be for LiveView but I realized an LLM could help me port those function calls to Wk and it did just that!
Above a demo site with some drawings showing some pretty stressful cases for this style of work but hopefully showing the capabilities here. Great way to get your fly machine cpu throttled lol.
For the examples I simply asked an LLM (opus4.6 and codex5.3) to create them and it had no trouble one-shotting all of them. Which makes sense because canvas is most likely well represented in it’s dataset and its trivial for it to translate it.
I did have to massage the Boids example and add templating/instancing to make it work better and also “quantization” aka chomping the precision off the floats to avoid sending mb’s of data to do 60fps. With Wx this was not an issue of course.
Here is the source and it’s up on hex/hexdocs as well.
Happy to answer any questions or take feedback.























