jupyter-widgets-contrib / ipycanvas

Interactive Canvas in Jupyter
https://ipycanvas.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
685 stars 62 forks source link

thoughts on creating ipyfabric? #259

Open ianhi opened 2 years ago

ianhi commented 2 years ago

This would probably be a lot of work but want to put the idea out there. I think something like ipyfabric to enable using http://fabricjs.com/ would be really great, and could probably build on ipycanvas

martinRenou commented 2 years ago

Fabric provides interactive object model on top of canvas element

Nice!

and could probably build on ipycanvas

It might be more performant to create a specific widget for it. ipycanvas has to make extensive use of custom comms because the canvas API is more of a functional API.

The fact that fabricjs implements an object model makes it very easy to create widgets for it, and by doing that we can keep the rendering loop on the Front-end (while ipycanvas has to make the rendering loop in Python, not very performant animations 😞)

ianhi commented 2 years ago

Gotcha. And yeah fabric is pretty great -

hat fabricjs implements an object model makes it very easy to create widgets for it

This sitll requires manual effort right? Like there is no easy automated way to generate these?

martinRenou commented 2 years ago

Actually pythreejs is completely generated. So you can probably reuse some logic to automatically generate the widgets code from some kind of JSON spec that defines the models.