move mouse to drip white paint, press mouse to add neon curves, press delete or backspace to clear canvas
xxxxxxxxxx
//Sara Nejad
//Drawing machine inspired by Eno Henze and Jackson Pollock's painting: "Autumn Rhythm"
//move mouse and press mouse to paint, press 'delete' or 'backspace' to erase canvas
//----------------------------------------------------------------
// Variables
float rad = random(50, 200); //randomize radius for ellipse
float rando= 20; //pick a random number from 0-20
//vector classes
PVector location;
PVector velocity;
// Color variables
color brushColor = color(255); //set brush color
color c0 = 0;
color c1 = #C1FF00;
// Arrays
color[] fuzzyC = {c0, c1}; // color array for fuzzyC
//----------------------------------------------------------------
void setup(){
size(1500, 600, P2D);
smooth();
background(190, 180, 150);
location = new PVector(200, 200);
velocity = new PVector(2.5, 10);
}
void draw(){
brush();
fuzzy();
// paintDrops();
moveFuzzy();
}
void mousePressed(){
bigCurves();
}
// clear canvas when delete or backspace is pressed
void keyPressed() {
switch(key){
case DELETE:
case BACKSPACE:
background(190, 180, 150);
}
}
//----------------------------------------------------------------
//automated random paint drops(randomized size, color shade and location)
void paintDrops(){
//local variables
float rad= random (0.5, 10); // random value between 0.5 and 10 for ellipse radius
float x = width/3; //initial value for x
float y = height/2; //initial value for y
float dropColor = random(0); // random color shade for each paint drop
//display random paint drops
translate(width * noise(rando + 40), height * noise(rando + 50)); // slightly randomize drop location
rotate(10 * noise(rando + 50)); //rotate drop randomly but subtly based on variable rando
location.add(velocity);
if ((location.x > width) || (location.x < 0)) {
velocity.x = velocity.x * -1;
}
if ((location.y > height) || (location.y < 0)) {
velocity.y = velocity.y * -1;
}
noStroke(); //set stroke to 0
fill(dropColor, random(150, 255)); // set fill color and randomize opacity for each drop
ellipse(location.x, location.y, rad+ 2, rad); //draw ellipse
rando = rando + 5; //each time add five to rando to change location
}
//----------------------------------------------------------------
void brush() {
stroke(brushColor); //set stroke color to value declared in brushColor
strokeWeight(random(2,20)); // randomly alter the stoke size
point(mouseX,mouseY); //draw point according to mouse X & Y location
//mouseY= mouseY +1;
}
//----------------------------------------------------------------
void fuzzy(){
pushMatrix();
translate(width/3, height/3); //adjust location based on mouse x & Y values
for ( int j = 0; j < 10; j++) { //start at j=0 and repeat loop 5 times every time mouse if pressed, each time add 1 to j
rotate(radians(random(90)+random(30))); //rotate shape randomly
scale(random(0.2, 1)); //alter shape scale
for (int x = 50; x <= width; x+=400) {
for (int y = 50; y <= height; y+=400) {
location.add(velocity);
if ((location.x > width) || (location.x < 0)) {
velocity.x = velocity.x * -1;
}
if ((location.y > height) || (location.y < 0)) {
velocity.y = velocity.y * -1;
}
stroke(fuzzyC[0], random(10,100)); //set stroke color and randomize opacity
strokeWeight(0.1); //alter stroke weight
noFill();
beginShape(); //draw shape
vertex(location.x, location.y); // first point
bezierVertex(25, 25, 100, 50, random(50), 200);
bezierVertex(30, 130, 75, 140, 120, 120);
bezierVertex(35, random(25), 100, 30, 50, random(100));
bezierVertex(random(20), 130, 75, random(140), 200, 200);
bezierVertex(35, 25, random(100), 50, 40, 100);
vertex(location.x,location.y);
endShape();
}
}
}
popMatrix();
}
void moveFuzzy() {
location.add(velocity);
if ((location.x > width) || (location.x < 0)) {
velocity.x = velocity.x * -1;
}
if ((location.y > height) || (location.y < 0)) {
velocity.y = velocity.y * -1;
}
fuzzy();
}
//----------------------------------------------------------------
void bigCurves(){
pushMatrix();
translate(mouseX, mouseY); //adjust location based on mouse x & Y values
for ( int j = 0; j < 5; j++) { //start at j=0 and repeat loop 5 times every time mouse if pressed, each time add 1 to j
rotate(radians(random(60)+random(10))); //rotate shape randomly
scale(random(.8, 1.8)); //alter shape scale
for (int x = 50; x <= width; x +=400) {
for (int y = 50; y <= height; y+=400) {
stroke(fuzzyC[1], random(50,150)); //set stroke color and randomize opacity
strokeWeight(noise(0.1, 0.9)); //alter stroke weight
noFill();
beginShape(); //draw shape
vertex(30, 70); // first point
bezierVertex(25, 25, 100, 50, random(50), 200);
bezierVertex(30, 130, 75, 140, 120, 120);
bezierVertex(35, random(25), 100, 30, 50, random(100));
bezierVertex(random(20), 130, 75, random(140), 200, 200);
bezierVertex(35, 25, random(100), 50, 40, 100);
vertex(30,70);
endShape();
}
}
}
popMatrix();
}