jtpio / ipyp5

p5.js Jupyter Widget
BSD 3-Clause "New" or "Revised" License
41 stars 5 forks source link
jupyter jupyter-widget jupyterlab jupyterlab-extension

ipyp5

Build Status Documentation Status Code style: black pypi Python Versions License Binder

:warning: Disclaimer: this is a work in progress! :warning:

p5.js in the Jupyter Notebook using the Jupyter Widgets.

This project aims to be a follow-up of p5-jupyter-notebook, so that p5 can be used in JupyterLab (and in the classic Notebook) as a proper package.

Current Status

screencast

TODO

Goal

The ideal goal (disclaimer: not implemented yet) would be to write code like this in a notebook cell:

class MySketch(BaseSketch):
    W, H = 400, 400

    def setup(s):
        s.createCanvas(s.W, s.H)
        s.rectMode(s.CENTER)

    def draw(s):
        s.background('#ddd')
        s.translate(200, 200)
        for i in range(4):
            s.push()
            s.rotate(s.frameCount / 200 * (i + 1))
            s.fill(i * 5, i * 100, i * 150)
            s.rect(0, 0, 200, 200)
            s.pop()

sketch = MySketch()
sketch

Contributing

See CONTRIBUTING.md