p5
p5 copied to clipboard
p5: implement more of p5js API
we should implement more of the p5js API:
-
https://p5js.org/reference/
-
[x] path
-
[x] rotate
-
[x] scale
-
[x] transform
-
[x] push/pop
-
[x] bézier
-
[x] curve
-
[ ] frame-rate
-
[ ] resize-canvas
-
[ ] vector (just use
gonum.org/v1/gonum/spatial/r2.Vec
) -
[x] image loading, image display
-
[ ] keyboard callbacks
math
- [ ] noise (https://p5js.org/reference/#/p5/noise)
- [ ] noiseDetail (https://p5js.org/reference/#/p5/noiseDetail)
- [ ] noiseSeed (https://p5js.org/reference/#/p5/noiseSeed)
What about loading and rendering images, is it planned?
it wasn't. it's just been added to the TODO list :)
Keyboard events e.g. keyPressed()
are missing as well. I was thinking about adding such functionality here: https://github.com/go-p5/p5/blob/cbaf5d8b21ca3ae9f2d75af07728070a0939bf31/proc.go#L240 however you are the master of Golang and Gio, so I hope you could implement it :grin:
a first stab is over there:
- https://github.com/go-p5/p5/pull/52
but I am not completely satisfied with the API (nor with some limitations + performances. see: gio-list)
@sbinet Nice! I would like to prepare better PR, just give me few days.
PR attempt: https://github.com/go-p5/p5/pull/53.
Are you planning on implementing the noise(), noiseDetail() and noiseSeed()?
I've added those to the bucket list.
Perlin noise isn't super complicated and there are a couple of Go packages to implement it:
- https://github.com/aquilax/go-perlin
- https://github.com/ojrac/opensimplex-go (we could just import one of them and reuse)
@LCRERGO, do you want to give it a try ?
I've added those to the bucket list.
Perlin noise isn't super complicated and there are a couple of Go packages to implement it:
- https://github.com/aquilax/go-perlin
- https://github.com/ojrac/opensimplex-go (we could just import one of them and reuse)
@LCRERGO, do you want to give it a try ?
Sure, I'll take a look at it
for mouse and keyboard callback, isn't is possible to simply pass the gio events to the user callbacks? (instead of maintaining a global variable for current state of the mouse) keyPressed(key.Event) mouseChanged(pointer.Event)