DEV Community

Cover image for Why P5.js is one of the best  library for 2D

Why P5.js is one of the best library for 2D

leviathanprogramming profile image 𝐋𝐄𝑽𝐈𝑨𝐓𝐇𝐀𝐍 Programming ・1 min read

About P5.js

P5.js is an amazing <canvas> library and is very useful for rendering 2D and 3D graphics.
You can make anything from data graphing charts to games to physics simulations and more!

It is very easy to use, fast, efficient, and very amazing.
Some extensions of P5.js come with

  • Special Audio Functionality
  • ASCII art
  • built-in 2D collisions
  • Webcam usage
  • Particles
  • And more!

If you were to use Phaser and P5.js to make something, you would get almost the same result-- just that the P5.js code is more beginner-friendly.

Comparing P5.js to Three.js is a different story. I guess the 3D part of P5 isn't as advanced as Three.js.

What you can do with p5

  • You can efficiently draw very amazing 2D and 3D graphics
  • You can make fast, amazing, and efficient games with pre-loaded images/sprites
  • You can use the webcam and even texture 3D objects with images and videos!
  • You can render 3D meshes
  • Graph Data easily
  • And More

Here is the official website.
I hope you look into it and enjoy using it.

I'm sure that there are a lot of amazing libraries as well as this. I was told that P5.js was better than Phaser3.

If you find any typos/mistakes in the post, please tell me.
Thanks for reading.
Happy Coding!

Discussion (5)

Editor guide
kristianpedersen profile image
Kristian Pedersen

In my opinion, you forgot to mention the most important part - Daniel Shiffman's videos (Coding Train)! He's the reason I picked up JavaScript back in 2016.

Make sure to check out his coding challenge videos, where he makes amazing visuals using mathematics and physics:

waylonwalker profile image
Waylon Walker

The Coding Train is amazing!!!

leviathanprogramming profile image
leviathanprogramming profile image
𝐋𝐄𝑽𝐈𝑨𝐓𝐇𝐀𝐍 Programming Author

Ah, yes. Daniel Shiffman is an amazing guy.

nightwolfdev profile image

I used P5 for my Sports Whiteboard app.