Dynamic Drawing

sketch


function setup() {
    createCanvas(450, 600);
    background(220);
    text("p5.js vers 0.9.0 test.", 10, 15);
}
function draw() {
	noCursor();
	
	fromBlue = color( 130, 255, 240);
    toBlue = color(85, 215, 255);
    backColor = lerpColor(fromBlue, toBlue, mouseX/mouseY);
    background(backColor);
	
	noStroke();
	
	
	fill(255, 255, 255);
	ellipse(mouseX-100, 100, 100, 30);
	ellipse(mouseX-100, 90, 50, 30);
	
	ellipse(mouseX+300, 75, 160, 60);
	ellipse(mouseX+300, 55, 80, 50)
	
	ellipse(mouseY-200, 230, 160, 60);
	ellipse(mouseY-200, 210, 80, 50);
	
	ellipse(mouseY, 150, 100, 30);
	ellipse(mouseY, 140, 50, 30);
	
	fill(0, 255, 200);
    fromBlue = color( 90, 255, 90);
    toBlue = color(40, 255, 190);
    blueColor = lerpColor(fromBlue, toBlue, mouseX/mouseY);
    fill(blueColor);
	ellipse(350, 400, 650, 350);
	
	fill(0, 255, 100);
	fromBlue = color( 40, 255, 60);
    toBlue = color(30, 255, 150);
    blueColor = lerpColor(fromBlue, toBlue, mouseX/mouseY);
    fill(blueColor);
	ellipse(100, 475, 625, 350);
	
	fill(0, 255, 0);
	fromBlue = color( 35, 250, 30);
    toBlue = color(20, 245, 140);
    blueColor = lerpColor(fromBlue, toBlue, mouseX/mouseY);
    fill(blueColor);
	ellipse(300, 550, 700, 350);
	

    stroke(220,200,220);
	strokeWeight(2);
	line(mouseX, mouseY+40, 125, 315);
	
	noStroke();
	
	
    fill(255, 0, 255);
    triangle(mouseX, mouseY, mouseX, mouseY-40, mouseX-30, mouseY);
	push();
	
	fill(255, 0, 255);
    triangle(mouseX, mouseY, mouseX, mouseY+40, mouseX+30, mouseY);
	
	fill(255, 0, 200);
    triangle(mouseX, mouseY, mouseX, mouseY+40, mouseX-30, mouseY);
	
	fill(255, 0, 200);
    triangle(mouseX, mouseY, mouseX, mouseY-40, mouseX+30, mouseY);
	
    stroke(40,100,200);
	strokeWeight(20)
	line(30, 450, 30, 550);
	
	stroke(40,100,200);
	strokeWeight(20);
	line(70, 450, 70, 550);
	
	noStroke();
	fill(40, 100, 200);
	ellipse(50, 450, 60, 30);
    rect(20, 380, 60, 70);
	rect(36,365,24,30);
	ellipse(48,350,50);
		 
    stroke(40,100,200);
	strokeWeight(15);
	line(70, 390, 125, 315);
	
	stroke(40,100,200);
	strokeWeight(15);
	line(22.5, 387.5, 1, 470);
	
	
	
	
	
    
	


}

Leave a Reply