TSWARSTA- Section A- Project-03-Dynamic-Drawing

swarstad-dynamic-drawing


var sizex = 0;

function setup() {
	createCanvas(640, 480);
}

function draw() {
	rectMode(CENTER);
    noStroke();
R=(640-mouseX)/2;
G=(480-mouseY)/2;
B=mouseX*(0,255);
//Altering color based on mouse position

background(B,R,G);
//altering background color based on mouse position

sizex=mouseX/2;
if (sizex>160){
	sizex=mouseX/-2;
};
//altering position and size based on x mouse position


sizey=mouseY/2;
if(sizey>120){
	sizey=mouseY/-2;
};
//altering position and size based on y mouse position

rot=PI/(640/mouseX);
//altering rotation based on x position

	fill(R, G, B);
    translate(mouseX, mouseY);
    rotate(rot);
	rect(0, 0, sizex, sizey);
 

}


I was inspired by Jamie XX’s “In Colour” album artwork and visuals. I created a square that is drawn on a background where the color is altered based on mouse location – this is to mimic the spectrum in the album artwork’s background. The shape itself is a square and is altered by the mouse x and y, depending on the quadrant it is in (if you divide the canvas size into 4 parts) as I wanted the location of the shape to respond to the mouse placement as well.

Leave a Reply