Blog

13Dec/130

A Guide for Creating Basic Geometric Illustrations

Processing Icon

Hey all,

Apart from sound design & field recording for a short movie project, I've taken part in another exhibition at a local bar (called Arkaoda) in Kadikoy, Istanbul. Lately I've been lurking around and wanted to create something graphical for myself. It is pretty basic, but it looks nice and it forms a good basis for further development ideas.

In this project, I wanted to create some colorful geometric graphics with Processing platform. I didn't have anything in my mind in particular, so in the end the project had the feature to change the visuals at each mouse click. Think of this as a little push if you want to start with a new project but can't do it. Just play with the code, add stuff, delete stuff, change stuff... Use the empty draw function for example.

The code is here:

/* A pretty basic code for creating randomly generated triangles with random colors.
*  Deniz Saglam, 2013
*/

float alpha = 0.0;
int triangle_count = 40;

void setup()
{
size(600, 480); //size of canvas, initially 600 x 480. play around with this to see the difference.
background(200); //canvas background
color c = color (0, 0, 0);
noStroke();
for (int iter = 0; iter < triangle_count; iter++) {
alpha = random(100.0, 255.0);
c = color(random(255.0), random(255.0), random(255.0)); //a random color is generated for filling the triangles at each iteration
fill(c, alpha); //triangles are actually filled with the previously generated color, and have an alpha (transparency) value

//this next line can be edited for different visuals.
triangle(random(height), random(height), random(height + height * 0.24), random(height) + random(height + height * 0.24), random(width), random(width + width * 0.133)); //create a new triangle at each iteration
}
}

void draw() {
}

void mouseClicked() {
print("Mouse is clicked. \n");
color c4 = color(random(50.0, 155.0), random(50.0, 155.0), random(50.0, 155.0)); //create new color for background
background(c4); //new random background is colored
color c = color (0, 0, 0);
noStroke();
for (int iter = 0; iter < triangle_count; iter++) {
c = color(random(255.0), random(255.0), random(255.0));
fill(c, random(100.0, 255.0)); // fill the triangles

//this next line can be edited for different visuals.
triangle(random(height), random(height), random(height + height * 0.24), random(height) + random(height + height * 0.24), random(width), random(width + width * 0.133));
}
}

 

Share
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.