Closed villares closed 1 year ago
Hey @villares! Give me a few days to look this over and chart a path forward. This is a nice nudge to resume building a standard Skulpt package for p5.js and to add that runtime to pyp5js.
@villares I started tinkering with this again and just tried the new examples out on mybinder.org -- things seem to work now. Here's a turtle sketch I wrote 🐢
from jupy5 import turtle
with turtle(400, 400) as t:
t.pendown()
t.setspeed(4)
d = 100
s = 1
while d > 10:
t.pensize(s)
t.forward(d)
t.right(90)
d *= 0.9
s *= 0.9
@tabreturn curious to know your thoughts on a p5 implementation for Jupyter. Here are some example sketches 🌺
from jupy5 import sketch
with sketch(400, 400) as p5:
p5.background('dodgerblue')
p5.fill('limegreen')
p5.stroke('orange')
p5.stroke_weight(5)
p5.circle(200, 200, 50)
await p5.pause(4)
from jupy5 import sketch
with sketch(400, 400) as p5:
p5.fill('limegreen')
p5.stroke('orange')
p5.stroke_weight(5)
x = 0
y = 200
r = 25
def draw():
global x
p5.background('dodgerblue')
p5.circle(x, y, 2 * r)
x += 1
if x > 400:
p5.stop()
await p5.loop(draw)
Thanks for sharing @nickmcintyre. Very cool and interesting ... this is also the first time I've encountered ipycanvas. Busy playing with it right now.
This looks wonderful and also looks like perhaps it could work in mybinder.org?
But I couldn't see the output. Maybe there is some missing "portal" infrastructure needed. You might have a look at http://py5.ixora.io for further inspiration, maybe. It is a much "heavier" project, as it needs to install JDK to the env in order to access Processing Java .jar infrastructure. Your idea is very appealing as it is a "lighter" option targeting the p5js infrastructure.