B-DC 121
Computation in Design
2020
B-DC 121
Computation in Design
2020
Introduction to Code
to develop a basic understanding of coding principles and their applications in design through shapes, color and transformations.
Coding Images 2
To automate image making through repetition.
Coding Images 1
To apply conditions and instructions in code.
Briefing Exercise 3
In class workshop and development
B-DC 121
Computation in Design
2020
Finalising Exercise 3 & Open Feedback Session
Review and Preparation of Digital Portfolio for Submission
Assessment
Assessment Preparation
Coding Images 3
In class workshop and development
In class workshop and development
B-DC 121
Computation in Design
2020
Week 7
B-DC 121
Computation in Design
2020
Week 7
B-DC 121
Computation in Design
2020
Week 7
B-DC 121
Computation in Design
2020
Week 7
B-DC 121
Computation in Design
2020
Week 7
B-DC 121
Computation in Design
2020
Week 7
B-DC 121
Computation in Design
2020
Week 7
B-DC 121
Computation in Design
2020
Week 7
B-DC 121
Computation in Design
2020
Week 7
B-DC 121
Computation in Design
2020
The video on the right shows you how to use the Open Processing tutorial view. The tutorial Getting Started is divided into 8 parts to introduce a basic code foundation on working with code and visual elements.
For this week you will focus on parts 1 - 4. At the end of each step, you will find a paragraph starting with the word TRY. These prompts serves to help you understand each part better by making active changes to the code on the right side.
When you watch the video, notice that you can change the editor view from a 2-column to a 3-column view.
Week 7
B-DC 121
Computation in Design
2020
only steps 1–4 required
only steps 1 and 2 required
Week 7
B-DC 121
Computation in Design
2020
Requirements
Specifications
Week 7
B-DC 121
Computation in Design
2020
B-DC 121
Computation in Design
2020
B-DC 121
Computation in Design
2020
B-DC 121
Computation in Design
2020
B-DC 121
Computation in Design
2020
Week 8
B-DC 121
Computation in Design
2020
Width
Height
Origin
0 / 0
Week 8
B-DC 121
Computation in Design
2020
Week 8
B-DC 121
Computation in Design
2020
Your p5js canvas works like a piece of graph paper. When you want to draw something, you specify its coordinates on the graph. Here is a simple rectangle drawn with the code rect(20, 20, 40, 40)
If you want to move the rectangle 60 units right and 80 units down, you can just change the coordinates by adding to the x and y starting point: rect(40 + 60, 40 + 80, 40, 40) and the rectangle will appear in a different place.
But there is a more interesting way to do it: move the graph paper (the coordinate-system) instead. If you move the graph paper 60 units right and 80 units down, you will get exactly the same visual result. Moving the coordinate system is called translation.
push();
translate(60,80);
rect(20,20,40,40);
pop();
rect(20,20,40,40);
Transformations let you group visual elements enclosed within push() and pop(). All elements inside this group can be moved translate(), rotated rotate() and scaled scale() at once and together.
Week 8
B-DC 121
Computation in Design
2020
function setup() {
createCanvas(400,400);
}
function draw() {
// draw a rectangle by translating
// the origin to location 80,100
push();
translate(80,100);
rect(0,0,40,40);
pop();
}
Benefits
Lets you group visual elements enclosed within push() and pop(). All elements inside this group can be moved translate(), rotated rotate() and scaled scale() at once and together.
Week 8
B-DC 121
Computation in Design
2020
Getting Started
Shapes
Colors
Custom Lines and Shapes
Transformations
Loop
Variables
Arrays
Color Modes
RGB and HSB
Shapes
rect()
ellipse()
triangle()
line()
custom shapes
B-DC 121
Computation in Design
2020
// declare a variable
let val;
// assign value 0 to variable val
val = 0;
// make changes to val
val = val + 1; // increases val by 1
// (val was 0 then we add 1 so val is now 1)
Variables are containers that store values. You start by declaring a variable with the let keyword, followed by the name you give to the variable. (sometimes you might see the keyword var which is similar to let but let is preferred)
Week 8
B-DC 121
Computation in Design
2020
Commands
// declare a global variable with name val
// a global variable can be accessed
// from anywhere here
let val;
function setup() {
// assign value 0 to variable val
val = 0
}
function draw(){
// increase the value of val
// by 1 for each frame and assign
// this new value to variable val
val = val + 1;
}
Benefits
Lets you store a value (number, string, letter, boolean, etc.) in memory, assigned to a name, which you can then query and change while the program is running.
Week 8
B-DC 121
Computation in Design
2020
rect()
ellipse()
triangle()
beginShape()
endShape()
vertex()
fill()
stroke()
push()
pop()
translate()
rotate()
scale()
Reference
Tutorial
Week 8
B-DC 121
Computation in Design
2020
frameCount
sin()
Reference
Tutorial
From static to dynamic images. When a sketch runs, it updates the draw() function 60 times a second by default – it runs at a frameRate of 60. While a sketch is running we can use numbers that are changing to introduce change over time.
For example we have a number which is called frameCount. Every frame this number changes it increases by 1. When a sketch starts, frameCount starts counting from 0 and then changes to 1, 2, 3, etc with every frame past.
frameCount
We all remember the sine function from our trigonometry classes, and very likely we can say that not many of us particularly liked it. In coding, however, the sine function can be very useful and a great companion when introducing movement.
sin()
The sine function is a periodic function because it is repeated over a distance of 2π. Visually, the sine function looks like a wave. We can use this property to create a smooth oscillating motion, as illustrated in the next slide.
Week 8
B-DC 121
Computation in Design
2020
frameCount
sin()
Reference
Tutorial
The radian is a unit of measure for angles used mainly in trigonometry. It is used instead of degrees. A full circle is 360 degrees which equals to 2π radians (Roughly 6.28).
Week 8
B-DC 121
Computation in Design
2020
Requirements
Specifications
Week 8
B-DC 121
Computation in Design
2020
Week 8
In-class
Upload to shared folder
Homework
Update Digital Portfolio
B-DC 121
Computation in Design
2020
Reference
Tutorial
Week 9
if-else statements (often referred to conditionals) are used in a program to make decisions.
We can use conditionals to introduce changes and decisions that depend on different states within a program.
B-DC 121
Computation in Design
2020
Exercise 3 Coding Images concludes the series of exercises for Computation in Design 1. In this exercise you will create a series of coded sketches that focus on 2D shapes in motion.
Follow the briefing, deliverables and references in the following slides.
B-DC 121
Computation in Design
2020
Exercise 3 Coding Images concludes the series of exercises for Computation in Design 1. In this exercise you will create a series of coded sketches that focus on 2D shapes in motion.
Students to work on exercise 3 individually.
For this exercise, take these 3 steps
1
(Re)interpret a given text fragment or one or more attributes from a given list in code with p5js.
Take inspiration from the references shared in the following as a guide for developing your visual elements and aesthetics and sketch them out on paper first.
Apply the following concepts in code: Shapes, colours, movement through change over time, conditionals, repetition.
2
3
B-DC 121
Computation in Design
2020
Use one or more attributes listened on this page.
“If you can’t give me poetry, can’t you give me poetical science?”
― Ada Lovelace
“No, emptiness is not nothingness. Emptiness is a type of existence. You must use this existential emptiness to fill yourself.”
― Liu Cixin, The Three-Body Problem
“There is no such thing as an empty space or an empty time. There is always something to see, something to hear. In fact, try as we may to make a silence, we cannot.”
― John Cage, Silence: Lectures and Writing
“I believe in the balance between dreaming and building.”
― Neri Oxman
“Cyberspace. A consensual hallucination experienced daily by billions of legitimate operators, in every nation, by children being taught mathematical concepts... A graphic representation of data abstracted from banks of every computer in the human system. Unthinkable complexity. Lines of light ranged in the non-space of the mind, clusters and constellations of data. Like city lights, receding...”
― William Gibson, Neuromancer
“I have no regrets. My life is squares, triangles, lines.”
― Vera Molnar
B-DC 121
Computation in Design
2020
For this exercise, the following deliverables are required, detailed information see handout document
1
Images and Videos. To document your process by taking screenshots and screen recordings of your work regularly.
Written Reflection. Reflect on your exercise 3 process and outcomes in writing.
Code. First work on a series of code sketches (2-4 different approaches) of which you will then focus on one selected-sketch and present it in week 12. Download selected-sketch as .zip file and add to your Digital Portfolio.
2
3
Exercise 3 Coding Images concludes the series of exercises for Computation in Design 1. In this exercise you will create a series of coded sketches that focus on 2D shapes in motion.
Students to work on exercise 3 individually.
B-DC 121
Computation in Design
2020
Exercise 3
Week 9
B-DC 121
Computation in Design
2020
Exercise 3
Week 9
Coding Images
B-DC 121
Computation in Design
2020
Exercise 3
Week 9
Coding Images
Links
B-DC 121
Computation in Design
2020
Exercise 3
Week 9
Coding Images
Links
B-DC 121
Computation in Design
2020
Exercise 3
Week 9
Coding Images
Links
B-DC 121
Computation in Design
2020
Exercise 3
Week 9
Coding Images
B-DC 121
Computation in Design
2020
Exercise 3
Week 9
Coding Images
Links
B-DC 121
Computation in Design
2020
Exercise 3
Week 9
Coding Images
Links
B-DC 121
Computation in Design
2020
Exercise 3
Week 9
Coding Images
B-DC 121
Computation in Design
2020
Exercise 3
Week 9
Coding Images
Tutorials
B-DC 121
Computation in Design
2020
Exercise 3
Coding Images
Tutorial
B-DC 121
Computation in Design
2020
Reference
Tutorial
Week 10
When repeating one section of code multiple times, for-loops here are very useful.
for(let i=0; i<10; i++) {
rect(20, i*10, 60, 5);
}
A for-loop consists of three different expressions inside of a parenthesis. These expressions are used to control the number of times the loop is run.
The code inside of the loop body (in between the curly braces) is executed while the loop is active.
B-DC 121
Computation in Design
2020
for(let i=0; i<10; i++) {
rect(20, i*10, 60, 5);
}
The basic functionality of a for loop:
A for loop allows us to execute code multiple times in a row by incrementing (or decrementing) a variable – often called i – until an expression is no longer true and the loop stops.
In the above example, we initialise a variable with the number 0, iterate as long as our variable is lower than 10, and increment our variable by one between each iteration. The result is a loop that iterates ten times with our variable incrementing from zero to nine, drawing ten rectangles on the screen.
Week 10
code to visual
B-DC 121
Computation in Design
2020
for(let i=0; i<10; i++) {
rect(20, i*10, 60, 5);
}
rect(20, 0, 60, 5);
rect(20, 10, 60, 5);
rect(20, 20, 60, 5);
rect(20, 30, 60, 5);
rect(20, 40, 60, 5);
rect(20, 50, 60, 5);
rect(20, 60, 60, 5);
rect(20, 70, 60, 5);
rect(20, 80, 60, 5);
rect(20, 90, 60, 5);
Week 10
B-DC 121
Computation in Design
2020
Week 10
function setup() {
createCanvas(400,400);
}
function draw(){
// draw a column of 10 rectangles
for(let i=0; i<10; i++) {
// use translate transformation
// to position rectangles
push();
translate(20, i*10);
rect(0,0, 60, 5);
pop();
}
}
Commands
code to visual
B-DC 121
Computation in Design
2020
Week 8
function setup() {
createCanvas(400,400);
}
function draw(){
// draw a grid of 10x10 rectangles
for(let i=0; i<10; i++) {
for(let j=0; j<10; j++) {
// use translate transformation
// to position rectangles
push();
translate(i*20, j*20);
rect(0, 0, 10, 10);
pop();
}
}
}
Commands
code to visual
B-DC 121
Computation in Design
2020
Exercise 3
Coding Images
For this exercise, take these 3 steps
1
(Re)interpret a given text fragment or one or more attributes from a given list in code with p5js.
Take inspiration from the references shared previously as a guide for developing your visual elements and aesthetic; sketch them out on paper first.
Apply the following concepts in code: Shapes, colours, movement through change over time, conditionals, repetition.
2
3
Week 10
This exercise is not only about code but also about visuals, visual language, aesthetics, movement, behaviour.
Create visuals using simple shapes
Abstractions vs literal
Form, Movement, Narrative
B-DC 121
Computation in Design
2020
Today we take it a bit slower on the requirements for this exercise. Some students will progress faster from now than others.
There will be 1 more live demo and then a review of what we have covered so far.
Some students might be intimidated at this point so we need to ease any anxieties that may appear at this point.
After the first part of class, we go around and help students with their technical questions, issues, anxieties by sitting down with them. (explain and code)
The exercise is not only about code but also visuals, visual language, aesthetics, movement, students should develop some curiosity and sensitivity to those now as well.
References: not to be copied but inspired by.
Abstractions vs literal
form, movement, narrative
Exercise 3
Coding Images
B-DC 121
Computation in Design
2020
Exercise 3
Coding Images
1
Complete and finish Exercise 3 so that your final sketch runs in full-screen mode on your laptop.
Week 12
3
Open feedback session starts at 12:00pm, all works to be ready and running.
9:45 - 11:45
12:00 - 12:30
2
Submission briefing
11:45 - 12:00
B-DC 121
Computation in Design
2020
Exercise 3
Coding Images
1
Complete and finish Exercise 3 so that your final sketch runs in full-screen mode on your laptop.
Week 12
2
Take a photo of your final setup with your sketch running in full-screen mode on your laptop.
3
Take another photo of of the same setup now with one of your classmates looking at the screen.
4
Add photos to your Digital Portfolio
exercise-3 → images → exercise-3-setup-1.jpg
exercise-3 → images → exercise-3-setup-2.jpg
B-DC 121
Computation in Design
2020
Digital Portfolio
Add Activity 3 and Exercise 3 to existing Portfolio.
Review screenshot to the right for proper folder structure handling and labelling.
B-DC 121
Computation in Design
2020
Digital Portfolio
B-DC 121
Computation in Design
2020
Prepare for Submission
Week 12