Paper.js Code Snippets
Also check out the official docs!
General
Get the center of the screen ↓
Clear the whole canvas ↓
Points
Create a point ↓
Add and subtract points ↓
Multiply points ↓
Random points ↓
Paths
Get length of path ↓
Get location of center of path ↓
Move location of path ↓
Create a generic path ↓
Create a rectangle ↓
Create a circle ↓
Create a polygon with n sides ↓
Smoothing a path ↓
Adding curves to a path ↓
Get point on a path ↓
Groups
Create a new group ↓
Add children to the group ↓
Apply styles to all children in a group ↓
Styling items
Fill color ↓
Stroke color ↓
Sizing and positioning
The bounds object ↓
Rotating items ↓
Scaling items ↓
Fitting items to bounds ↓
Fitting items to a size ↓
Interactivity
Mouse movement / onMouseMove ↓
Mouse clicks / onMouseDown ↓
Frame by frame animation / onFrame ↓
Screen size changed / onResize ↓
Handy tricks
Download the current canvas as an svg ↓
Download the current canvas as a png ↓
My random number function ↓
My random color function ↓