UAL CCI: Introduction to Creative Computing Intensive 2022: βš–οΈ & 🌊: 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 recently? 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:

Unendurable lineο½œγ‚¬γƒžγƒ³γŽγ‚ŠγŽγ‚Šγƒ©γ‚€γƒ³ from daihei shibata.

Let's take a look at p5.js easing example to see how to create animation that follows the user's mouse. We can also use the lerp() function to do this - this is known as linear interpolation, or how to blend between known values.
Let's take a look at the p5.js lerp colour example to see how the random() function can be used for infinite graphical output.
Let's make some animations using colour and sine and cosine:
https://p5js.org/examples/math-sine.html
https://p5js.org/examples/math-sine-cosine.html
In each of those last two examples, what if we used interactive variables (like mouse position) instead of just adding on to (or incrementing or the ++ symbol) the angle variable every frame? 🀯
Bringing together drawing, transformations and push and pop to make a lovely follow interaction.
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.