-
Notifications
You must be signed in to change notification settings - Fork 38
Week 1 warmups
Lauren McCarthy edited this page Sep 3, 2015
·
14 revisions
An exercise inspired by the Conditional Design group. Read their manifesto and check out the archive of instructions and drawings. Check out knots, hatching, and convex city plan.
- Break into partners. As a team, devise a set of instructions to create a drawing. Write out the instructions on paper provided.
- Switch instructions with another pair. You create a drawing based on their instructions, and they create a drawing based on yours.
- Visit http://lauren-mccarthy.com/test/p5, you should see a p5 program running.
- Right click on the drawing and choose "Inspect Element".
- In the window that pops up, click on "Sources" in the gray bar at the top.
- Click on
sketch.js
in the menu on the left, you should see some code show up on the right. - Try changing some of the numbers inside the parts where it says
ellipse()
,rect()
,background()
, andfill()
. Presscommand+s
orctrl+s
to save. Notice what happens in the browser window. - Try reloading the page. What happens? Why?
In the last part we realized we could mess with the code in the browser, let's look at how we can create this code ourselves from scratch.
- Download the p5.js editor.
- Try adding some of the lines of code from the list below into the places where it says
setup()
anddraw()
. Press the play button to run your code. - Can you figure out what each of the lines does? What is the difference between
setup()
anddraw()
?
createCanvas(w, h);
ellipse(x, y, w, h);
rect(x, y, w, h);
line(x1, y1, x2, y2);
triangle(x1, y1, x2, y2, x3, y3);
fill(g);
fill(r, g, b, a);
stroke(r, g, b, a);
strokeWeight(weight);
background(r, g, b, a);
print(s);
random(max);
second();