top of page
Martin Calvino

week_1: intro to p5.js


function setup() {

createCanvas(980, 490);

}

function draw() {

background(255);

frameRate(1);

for (var i = 0; i < width; i=i+20) {

stroke(255);

strokeWeight(5);

line(i, 0, i, height);

noFill();

ellipse(i, random(height), 30, 30);

if (i < width/2 && random(height) > 300) {

noStroke();

fill(100, 40, 78, 60);

ellipse(i, random(height), 20+i, 20+i);

fill(30, 70, 120, 40);

rect(i, random(height) + 30, i, 5);

}

}

}

I used a 'for' loop to draw consecutive vertical lines across the canvas, each lines spaced every 20 pixels. Ellipses were drawn at same positions along the x-axis than the vertical lines, with their position along the y-axis determined by random numbers (0 to 490 pixels). The diameter of white ellipses is fixed, while the diameter of relish ellipses is dependent on their position along the x and y axis, respectively. This was implemented using an 'if' statement. Similarly, red rectangles were drawn using the 'if' statement as well.

Because I used a white background, fixed ellipses and vertical lines that are painted in white are only visible when reddish ellipses and red rectangles are superimposed on them.

The animation plays one time per second as determined by frameRate() function; and because all of the code was placed within the draw() function.

How does computation apply to my interests?

I am interested in computation for the creation of abstract art (static and animated) and interactive art installations. Primarily at the intersection of art with genomics, and art with dance (tango).

What projects do I imagine making this term?

I intend to focus my efforts on those projects in which I could image an integrative approach with the knowledge learning from other classes as well. Concrete examples are:

# computational media + physical computing

# computational media + video & sound

# computational media + animation

bottom of page