Nature of Code
These videos accompany The Nature of Code book.
Welcome15 Feb 2020
Welcome to the Nature of Code 2.0! In this video, I give an overview of the playlist and The Nature of Code book (originally published in 2012).
Introduction15 Feb 2020
Welcome again to Nature of Code! Here, I give a quick overview of the “Introduction” section of The Nature of Code.
What is a Vector15 Feb 2020
Welcome to Nature of Code Chapter 1: Vectors! What is a vector? How do they work in p5.js? These questions will all be answered in this first section of this series on p5.Vector.
Getting Started with Vector Math15 Feb 2020
This video covers the very basics of vector math focusing on vector addition and looks at how to apply the concept of velocity to a position vector in the random walker example.
A Random Vector15 Feb 2020
This video covers how to initialize a p5 vector with p5.Vector.random2D().
Static Functions18 Mar 2020
Unit Vector (Normalize)20 Mar 2020
In this video, I explain the concept of a “unit vector,” what it means to “normalize” a vector, and take a look at the p5.js functions: p5.Vector.mag(), p5.Vector.normalize(), p5.Vector.setMag().
Acceleration Vector22 Mar 2020
In this video, I add an “acceleration” vector to the Mover object and create an example where the object accelerates towards the mouse location. This is the foundation on which I will build for implementing forces in the next chapter!
Simulating Forces23 Mar 2020
In this video I introduce Newton’s Laws of Motion, and apply the concept of a “force” to a p5.js sketch with a mover object and two forces: gravity and wind.
Mass and Acceleration31 Mar 2020
In this video, I add a mass property to the Mover class and examine how a mass property impacts gravity and wind forces.
Friction Force07 Apr 2020
In this video, I cover how to read the formula for kinetic friction and incorporate it into a p5.js sketch with the Mover applyForce() function.
Drag Force08 Apr 2020
In this video I implement the formula for a “drag” force with p5.js (also known as air resistance or fluid resistance) and similar objects falling into a liquid.
Gravitational Attraction17 Apr 2020
In this video, I demonstrate how to apply Newton’s Law of Universal Gravitation in p5.js using vectors and forces.