Month: June 2015
-
Object-Oriented Programming
In order to create Generative Art through the medium of code, we first need several new tools. You will need to learn the basics of object-oriented programming (OOP). If you’re a seasoned programmer, you’re probably already familiar with this concept — very few languages above a certain power and sophistication don’t accommodate object-oriented structures. OOP…
-
Generative Art
The term originated in a paper by Philip Galanter, artist and professor at Texas A&M University, he wrote “Generative art refers to any art practice where the artist uses a system, such as a set of natural language rules, a computer program, a machine, or other procedural invention, which is set into motion with some…
-
Exercise 30
Let’s replace our while loop with a For Loop to see how it works int ellipseSize = 40; void setup() { size(800, 800); smooth(); } void draw() { noFill(); strokeWeight(.5); stroke(255); for (int i=0; i
-
Exercise 29
now let’s improve our grid sketch by overlapping the circles and giving them a random transparency size(400, 400); noStroke(); background(255); float x = 0; while (x < width) { float y = 0; while (y < height) { if (random(100) > 98) { fill(255, 0, 0, random(50)); } else { // but usually pick a…
-
Exercise 28
Now let’s change our rectangle to a circle and adjust the spacing size(400, 400); noStroke(); background(255); float x = 0; while (x < width) { float y = 0; while (y < height) { if (random(100) > 98) { fill(255, 0, 0); } else { // but usually pick a random gray color fill(random(100, 200));…
-
Exercise 27
Adding a small probability of a red square to our grid size(400, 400); noStroke(); background(255); float x = 0; while (x < width) { float y = 0; while (y < height) { if (random(100) > 98) { fill(255, 0, 0); } else { // but usually pick a random gray color fill(random(100, 200)); }…
-
Exercise 25
now let’s nest a while loop inside another while loop to give us a grid size(400, 400); noStroke(); background(50); float x = 0; while (x < width) { float y = 0; while (y < height) { rect(x, y, 30, 30); y = y + 40; } x = x + 50; }
-
Exercise 24
Now let’s rotate but change the center point of our rotation. We do that using the translate() function. float r = 0; void setup() { size(400,400); background(10); smooth(); noStroke(); } void draw() { translate(width/2, height/2); fill(255); rotate(r); float circle_size = random(5, 15); ellipse(100 + r, 10, circle_size, circle_size); r = r + 0.2; println(r); }
-
Exercise 23
Continuing our experiments with rotation Think of the rotate() function like sticking a pin into the top left (0,0) corner of our piece of paper (our canvas) and turning the paper around the pin axis. float r = 0; void setup() { size(400,400); background(10); smooth(); noStroke(); } void draw() { fill(255); rotate(r); float circle_size =…
-
Exercise 22
Rotating Objects size(400,300); background(#6AA21E); noStroke(); smooth(); float c = 0; while(c < 100) { fill(random(255)); rect(200,10,50, 5); fill(255, 0, 0); rect(260,10,10, 5); rotate(0.02); c = c + 1; }