Hi!
I'm going to start every lecture with a promise and an artist to reference.
I promise that by the end of this lecture you'll be able to harness lists and randomness to create infinite variety on which to use your human intuition on.
A video of Vera talking about Randomness.
I think alot of Vera's work is about listing and randomising, which is why she's perfect for today's lecture - which is on exactly those things!
The three things I want you keep in mind today are that the computer science word for a list is an array and that computers can generate both random numbers and noise, which is almost random, but not quite.
By the end of this lecture, you'll know more about:
- JavaScript objects and how they can store lots of different types of information in one place
- Lists or one dimensional arrays
- Two dimensional arrays or lists that have a list for each of their entries
- N (or any) dimensional arrays
- Random functions
- Noise functions
JavaScript objects and how they can store lots of different types of information in one place.
Lists or one dimensional arrays.
You are all familiar with shopping or todo lists. The coding terms for those things would be one dimensional arrays. Let's take a look at what
The Modern JavaScript Tutorial says about arrays. Remember - Strings are just arrays of Chars or characters.
Two dimensional arrays or lists that have a list for each of their entries.
Instead of a char, an integer, a float in each position in an array, what if you stored an array there? Then you'd have a list of lists, or a two dimensional arrays. Can you think of a type of information that you look at every day that might be well suited to storing in a two dimensional array? Something with a width and a height perhaps?
An image!
Question, how might you store a two dimensional array within a one dimensional one?
Just make a big one dimensional array and put each row of the two dimensional array side by side!
N (or any) dimensional arrays.
Let's take a look at some p5.js examples that use arrays.
Random functions
Noise functions.
In 1983,
Ken Perlin invented
Perlin Noise, for which he recieved an Oscar in 1997. Perlin Noise can be used to generate realistic looking clouds, landscapes or many other natural features. Since then other noise generators have been invented - including
Simplex Noise and
Worley Noise. As an aside, there are many
colours of noise found in audio engineering and physics. Be careful when generating sound using noise - make sure not to accidentally hit the
Brown note.