Workshop Contents
Warm up (will be covered in slides, feel free to rewatch)
Introduction
Set up
Basic shapes and motions (will be covered in slides, feel free to rewatch)
Basic shapes functions: rect, ellipse, triangle
fill, stroke, strokeWeight;
Basic motions: random();
Task 1: getting familiar with shapes functions and random() (feel free to do it or you can jump to the next
Functions of basic Interactivity (will be covered in slides, feel free to rewatch the detailed walkthrough)
Creating Your Own Poster with the start files :
version without comment(in case your eyes are tired of looking at comments)
save your sketches and put them in Figma
To start your posters:
You don’t have to write anything new (you can if you want to) but instead:
Tweak/change the parameters: size, location, speed,
Change shapes (rect to ellipse, to triangle, to line etc) and be CREATIVE!!
Change colors, outline stroke
If you are not sure about any functions, check the documentation⬇️:
p5js.org/reference/ or Google is always your friend.
Warm up(5min ~ 8min)
Visit: https://editor.p5js.org/
Create an account (you can created with your google account)
Change background(220); to background(0);
Change createCanvas(400,400); to change createCanvas(windowWidth,windowHeight);
Click “run” (the play button on top-left);
Resize your browser window, you will find the canvas is not resizing while you are dragging
Copy and paste:
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}
At the end of your sketch
7. Click “run” and resize your browser
Note:
background(220) is exactly same as background(220,220,220); which means each values (RGB) is set to 220.
2. Basic Shapes and Motions
Visit: https://editor.p5js.org/liao.xiaohan/sketches/vgTBE-7BA
Go to File > Duplicate
Click “run” (the play button on top-left);
Please take a look at this code walkthrough videos while keep the program running.
Task 1: Messing with shapes (8min ~ 15min)
Now, you have basic ideas of drawing shapes in p5.js. We can start to get messy with these functions.
1.Go to https://editor.p5js.org/liao.xiaohan/sketches/ZP8kgqcMp
2.Files > Duplicate (and then you just fork this file under your sketch folder)
3.Change the text to your sketch name
4.Fill each shapes with different color by adjust RGB value in fill(…)
5.Outline each shapes with different color adjust RGB value in stroke(…)
6.Change the thickness by adjust strokeWeight(…)
7.Change the shape’s location
8.Change the size of shapes
9.Using random() to apply “flickering effect” to one of shapes
3. Functions of basic Interactivity
These coding files introduce more about rotate and for-loop. If you are interested to learn more about for-loop and rotate you can:
1. Go to https://editor.p5js.org/liao.xiaohan/sketches/-n3x4ikz7
2. File > duplicate
3. Make sure “Auto-refresh” is checked”
4. Watch the walkthrough tutorial video ⬇️
For-loop details:
*If you are wondering about how for-loops works, you can check this sketch
4.Creating Your Own Poster with the start files
version without comment(in case your eyes are tired of looking at comments)
save your sketches and put them in Figma
To start with:
You don’t have to write anything new (you can if you want to) but instead:
Tweak/change the parameters: size, location, speed,
Change shapes (rect to ellipse, to triangle, to line etc) and be CREATIVE!!
Change colors, outline stroke
Tips….
“Syntax error” is very common. Usually it is due to “typo”. Do not panic and check the console and refer to the line number to correct
“Comment out” is a good way to check the functionalities of your code. You can comment out the lines you think is buggy and test if your assumption is right.
Embrace “errors”, “accidents”. Happy accidents is the key to make generative design.
Start with baby-step. Modularize your work by separating one big task to small tasks.
Asking Google.
Experimenting and reading Documentations
Name your variable correctly.
Recreate by looking at others’ code to LEARN but remember to credit if your are using others’ resources.
References
Contains good creative coding examples and sketches.
Reference, examples, and documentations of p5.js functions.