Nature of Code
These videos accompany The Nature of Code book.
- #0.0
Welcome
15 Feb 2020Welcome 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).
- #0.1
Introduction
15 Feb 2020Welcome again to Nature of Code! Here, I give a quick overview of the “Introduction” section of The Nature of Code.
- #1.1
What is a Vector
15 Feb 2020Welcome 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.
- #1.2
Getting Started with Vector Math
15 Feb 2020This 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.
- #1.3
A Random Vector
15 Feb 2020This video covers how to initialize a p5 vector with p5.Vector.random2D().
- #1.4
Static Functions
18 Mar 2020In this video, I discuss the difference between static and instance functions in JavaScript and how they are used in the p5.Vector class.
- #1.5
Unit Vector (Normalize)
20 Mar 2020In 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().
- #1.6
Acceleration Vector
22 Mar 2020In 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!
- #2.1
Simulating Forces
23 Mar 2020In 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.
- #2.2
Mass and Acceleration
31 Mar 2020In this video, I add a mass property to the Mover class and examine how a mass property impacts gravity and wind forces.
- #2.3
Friction Force
07 Apr 2020In 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.
- #2.4
Drag Force
08 Apr 2020In 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.
- #2.5
Gravitational Attraction
17 Apr 2020In this video, I demonstrate how to apply Newton’s Law of Universal Gravitation in p5.js using vectors and forces.
- #3.1
Angles and Rotation
24 Jan 2021Welcome to Chapter 3 of The Nature of Code: Oscillating Motion! I begin in this video by explaining angles, the different units of measurements for angles: degrees and radians, and how to rotate shapes in p5.js.
- #3.2
Angular Motion
24 Jan 2021In this video, I explain how to apply the concepts of vector motion to angles (scalar!). Then I demonstrate how to rotate with angular motion in a p5.js sketch!
- #3.3
Angles and Vectors
28 Jan 2021In this video, I tackle a common question, how do you draw an object pointing in the direction it’s moving? I demonstrate how to calculate the angle associated with the direction vector as well as create an vector from an angle in p5.js.
- #3.4
Polar Coordinates
01 Feb 2021It’s finally time to dive into the trigonometric functions—sine, cosine, tangent—and take a close look at thinking in polar coordinates with p5.js!
- #3.5
Simple Harmonic Motion
01 Feb 2021What is a sine wave? In this video, I demonstrate how to use the sin() function in p5.js to simulate simple harmonic motion.
- #3.6
Graphing Sine Wave
01 Feb 2021What does a sine wave look like? In this video I look at how to graph and animate a sine wave in p5.js varying the period and phase.
- #3.7
Additive Waves
08 Feb 2021This video builds on the previous sine wave visualization in p5.js example. Here, I build a Wave class with variables for period, amplitude, and phase, and demonstrate how to add multiple wave patterns together!