p5 icon indicating copy to clipboard operation
p5 copied to clipboard

p5: implement more of p5js API

Open sbinet opened this issue 4 years ago • 9 comments

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)

sbinet avatar Nov 14 '20 08:11 sbinet

What about loading and rendering images, is it planned?

koxu1996 avatar Jun 27 '21 20:06 koxu1996

it wasn't. it's just been added to the TODO list :)

sbinet avatar Jun 28 '21 09:06 sbinet

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:

koxu1996 avatar Jun 30 '21 10:06 koxu1996

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 avatar Jul 02 '21 09:07 sbinet

@sbinet Nice! I would like to prepare better PR, just give me few days.

PR attempt: https://github.com/go-p5/p5/pull/53.

koxu1996 avatar Jul 03 '21 08:07 koxu1996

Are you planning on implementing the noise(), noiseDetail() and noiseSeed()?

LCRERGO avatar Nov 09 '23 01:11 LCRERGO

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 ?

sbinet avatar Nov 09 '23 09:11 sbinet

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

LCRERGO avatar Nov 09 '23 12:11 LCRERGO

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)

amirkhaki avatar Feb 22 '24 19:02 amirkhaki