DEV Community

Discussion on: Use Code to Make Stuff: p5.js

Collapse
 
bramses profile image
Bram Adams • Edited

Great points, Matei! I agree with you about the global variables being an issue, which can lead to weird unforeseen errors.

That said, I still think p5 is great. After playing with the vanilla JS web-canvas API, I find myself reinventing the wheel a lot. Depending on use case, and especially with generative art, I find p5 to be more than sufficient, unless I go crazy with WebGL and the p5.sound library.

I'd go so far as to claim p5 is made for expression, whereas the native API is made for production (people who are very familiar with the API and need very performant projects).

Finally, there are a lot of optimizations p5 makes under the hood that a developer may end up overlooking (for example: creating 100s of circles instead of copying one instance)

edit: very cool galaxy map btw!

Collapse
 
mateiadrielrafael profile image
Matei Adriel

You hit some great points!

  1. I also find myself reinventing the wheel a lot. If I'd want to build something bigger I'd go with something high level like pixi (or if you want something super low level but still nice you can take a look at picogl)
  2. I think the optimizations are really easy to miss, the best examples beeing those 2 quick doodles I linked in the original comment
  3. Yes, it's cool for generative art where you just want to take a screenshot of the final thing, but if you want something real time you might need to rewrite it in vanilla js (or another lib)

Again, i think it's a tool with an amazing educational value, but that comes at the cost of it not beeing the right tool for more advamced stuff