Phoenix LiveView draw image on HTML5 Canvas

Hi, I’m migrating an javascript program to Phoenix LiveView. In that program I use HTML5 Canvas with its “drawImage” (CanvasRenderingContext2D.drawImage() - Referencia de la API Web | MDN) method.

Is there a way to call that method from within Phoenix?.

One way would be to use a hook. Push events down to the view and have the hook process the event details into draw commands.

2 Likes

Thanks, yes, I was thinking about hooks, but I asked anyway hoping to find an easier, Elixir only, way.