This example demonstrates a ball bouncing on a slanted surface, implemented using vector calculations for reflection.
The code makes extensive use of the p5.Vector class, including the createVector() function to create new vectors, and the vector methods add() and dot() for the vector calculations.
Contributors: Ira Greenberg, davidblitz, Animesh Sinha, Katie, Caleb Foss, Darren Kessner
Modified from Non Orthogonal Reflection.
Originally ported from the Processing example Non-orthogonal Reflection.
Non-Orthogonal Reflection is licensed under CC BY-NC-SA 4.0.
Related Examples

A small green circle hovering over a yellow tilted plane at the bottom of the canvas.
Non-Orthogonal Reflection
Simulate a ball bouncing on a slanted surface.

A yellow pentagon on a black background.
Soft Body
Simulate the physics of a soft body accelerating toward the mouse.

9 multicolored circles at varying heights on a grey background.
Forces
Simulate forces on multiple bodies as they move through liquid.

Rainbow colored smoke angled towards the right of the canvas, with a white arrow above the smoke pointing right.
Smoke Particles
Simulate smoke with a particle system.

Grid of squares made of black lines on a white background. Some squares are filled in with solid black.
Game of Life
Recreate John Conway's cellular automaton.

Colorful rendering of the Mandelbrot set.
Mandelbrot Set
Visualize a mathematical set that produces fractal structures.