p5.js Coding Tutorial | A Shattered Heart πŸ’” (with matter.js) @pattvira
p5.js Coding Tutorial | A Shattered Heart πŸ’” (with matter.js)  @pattvira
Uploaded February 2025 | Updated November 2026, 3 hours ago
LET'S CONNECT
✨ Sign up for my newsletter at pattvira.com
✨ Instagram: instagram.com/pattvira
✨ Twitter: twitter.com/pattvira
--
Links:
πŸ”— p5.js editor: editor.p5js.org
πŸ”— A Shattered Heart Code: editor.p5js.org/pattvira/sketches/RwR7cL8Br
πŸ”— Introduction to Creative Coding Playlist: youtube.com/playlist?list=PL0beHPVMklwgMz4Z-mNp4_udo9mjBk7pn&si=XhvQaojd6cIrxvdn

Inspiration:
πŸ”— Lea Naisberg’s Piece: instagram.com/p/DGDfaswtQba

References:
πŸ”— matter.js: brm.io/matter-js
πŸ”— matter.js playlist: youtube.com/playlist?list=PL0beHPVMklwgaLt1xHqlKNvPZ7nKjHnH3

Timestamps:
0:00 Intro
0:33 Set up the physics engine and create a single rectangular body
5:55 Add mouse for some interactivity
8:36 Create multiple rectangular bodies
12:42 Preload an image to sketch
14:40 Create a grid of cells and check which contains color values
20:33 Combine matter.js and image sketches
24:59 Create a Rect class
29:01 Add pixels information to each Rect object
33:19 Add background
33:35 Add boundaries
p5.js Coding Tutorial | A Shattered Heart πŸ’” (with matter.js)p5.js Coding Tutorial | Music Visualization with FFT 🎡p5.js Coding Tutorial | Oscillating Wave Pattern (in 3D)p5.js Coding Tutorial |  Tic Tac Toep5.js Coding Tutorial | Intro to OpenType.js (Kinetic Typography)p5.js Coding Tutorial | Truchet Tilesp5.js Coding Tutorial | Text Distortionp5.js Coding Tutorial | Flocking Simulation with Quadtree 🐀🐀🐀p5.js Coding Tutorial |  Interactive Grid with Mouse Locationp5.js Coding Tutorial | Interactive Hexagonal Truchet Tiles with ml5.js (Part 3/3)Creative Coding Math: Oscillation - Simple Harmonic Motionp5.js Coding Tutorial | NileRed Logo (BZ Reaction)
Patt Vira |

p5.js Coding Tutorial | A Shattered Heart πŸ’” (with matter.js)

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER