Introduction to Creative Computing 2026/2027: ⚖️ & 🌊: Lecture 7: Scaling and Waves.
Back to slide index.
By the end of this lecture, we'll have learnt about:
Before we get started, did anyone see the floating robots at the Tate Modern in 2022? The installation was by Anicka Yi. The movement of the robots uses exactly the things we'll be learning about this morning. Technical collaborators on the project include: Airstage, Pozyx and KitMapper.
How to use lerp() and map() functions to scale variables between different values.
Let's take a look at the p5.js reference page for the lerp() function and the map() function.
Let's take a look at the p5.js map example to see how to use the map() function to take a mouse position and turn it into the radius and colour of a circle. This is a very powerful technique - taking one input value and scaling it to lots of different types of information - radius, colour or anything we like. One way to think of it is to think of taking a range of values and scaling them to a value between 0 and 1 - then you can take that value and scale to any other value. If you can get your values to 0-1 you can take that signal and apply it anywhere, to anything.
This idea of 0-1 values for anything is beautifully illustrated in the video below:

By Daihei Shibata.

We can use the lerp() function to do follow the user's mouse - this is known as linear interpolation, or how to blend between known values.
Let's take a look at the p5.js lerpColor (sic) example to see how it can be used to move from one colour to another.
Let's take a look at the Sine and Cosine example from p5js.org.
The Aim example uses trigonometry to make two eyes that follow the user's cursor.
Let's take a look at this beautiful animated example that uses animation, interaction and a loop within a loop. What happens if you play with the background command? What is it doing in this case?
Adding several waves together to make more complicated wave. This leads me to the final part of today's lecture something called the Fast Fourier Transform or FFT.
The Fast Fourier Transform (FFT).
Thanks! Time for a short break!
Back to slide index.