/** Press any key or click the mouse and drag the design and see what happens. Enjoy the hypnosis! */ int bigOrangeCircleDiameter = 1; //the big orange circle starts out really small int bigOrangeCircleGrowthRate = 5; int bottomRightCornerCircleDiameter = 500; int bottomRightCornerGrowthRate = 1; int pinkCircleDiameter = 300; int pinkCircleGrowthRate = -3; int greenSmallCircleDiameter = 1; int greenSmallCircleGrowthRate = 1; int blueCircleX = 550; int blueCircleRate = 2; int purpleCircleY = 180; int purpleCircleRate = 10; int greenDiagonalXY = 200; int greenDiagonalRate = 4; int smallPlumCircleX = 290; int smallPlumCircleRate = 8; int sunX = 700; int sunY = 150; int sunRate = 5; void setup() { size(800,800); smooth(); noStroke(); } void draw() { //draw the background background(68,66,211); //turn the background blue rectMode(CORNER); //Draw the big orange circle that grows and shrinks fill(247,101,42); //Orange fill ellipse(width/2,height/2,bigOrangeCircleDiameter,bigOrangeCircleDiameter); bigOrangeCircleDiameter = bigOrangeCircleDiameter + bigOrangeCircleGrowthRate; //grow diameter by 10 each time if (bigOrangeCircleDiameter>=1500 || bigOrangeCircleDiameter<0){ bigOrangeCircleGrowthRate = -1*bigOrangeCircleGrowthRate; //reverses the growth to shrink } //Draw the big purple triangle fill(201,66,211); triangle(width/2,0,0,height,width,height); //Draw medium circle in bottom right corner that shrinks and grows fill(5,227,28,100); ellipse(600,600,bottomRightCornerCircleDiameter,bottomRightCornerCircleDiameter); bottomRightCornerCircleDiameter = bottomRightCornerCircleDiameter - bottomRightCornerGrowthRate; if (bottomRightCornerCircleDiameter>=500 || bottomRightCornerCircleDiameter<0){ bottomRightCornerGrowthRate = -1*bottomRightCornerGrowthRate; } //Draw green circle in top left corner fill(26,255,15,150); ellipse(greenDiagonalXY,greenDiagonalXY,400,400); greenDiagonalXY = greenDiagonalXY + greenDiagonalRate; if(greenDiagonalXY<=200 || greenDiagonalXY>=600){ greenDiagonalRate *= -1; } //Draw pink circle in the center fill(255,15,15,90); ellipse(width/2,height/2,pinkCircleDiameter,pinkCircleDiameter); pinkCircleDiameter = pinkCircleDiameter + pinkCircleGrowthRate; if(pinkCircleDiameter>=300 || pinkCircleDiameter<0){ pinkCircleGrowthRate = -1*pinkCircleGrowthRate; } //Draw light blue triangle in top right corner fill(5,255,240,150); triangle(width*3/4,0,width,height/4,width/2,height/2); //Draw tall translucent yellow rectangle in bottom left fill(254,255,5,120); rect(80,350,200,450); //Draw small plum circle on the bottom, move horizontally fill(131,62,107,200); ellipse(smallPlumCircleX,680,210,210); smallPlumCircleX = smallPlumCircleX + smallPlumCircleRate; if(smallPlumCircleX >= 650 || smallPlumCircleX <= -200){ smallPlumCircleRate *= -1; } //Draw yellow square in the bottom right fill(255,247,5,255); rect(550,600,150,150); //Draw purple circle in the top left quadrant fill(114,9,116,255); ellipse(180,purpleCircleY,100,100); purpleCircleY = purpleCircleY + purpleCircleRate; if(purpleCircleY>=300 || purpleCircleY<=50){ purpleCircleRate *= -1; } //Draw pink circle in the top right corner - The Sun fill(247,2,7,150); ellipse(sunX,sunY,250,250); sunX = sunX - sunRate; sunY = sunY + sunRate; if(sunX >= 800 || sunX <= 200){ sunRate *= -1; } //Draw green flat triangle on the bottom fill(15,75,2,150); triangle(0,600,0,750,800,750); //Draw bright blue circle on top of yellow square fill(2,12,247,200); ellipse(blueCircleX,550,100,100); blueCircleX = blueCircleX + blueCircleRate; if (blueCircleX>=700 || blueCircleX<=550){ blueCircleRate *= -1; } //Draw green small circle in the center fill(24,142,1,255); ellipse(350,420,greenSmallCircleDiameter,greenSmallCircleDiameter); greenSmallCircleDiameter = greenSmallCircleDiameter + greenSmallCircleGrowthRate; if(greenSmallCircleDiameter>=60 || greenSmallCircleDiameter<=0){ greenSmallCircleGrowthRate *= -1; } //dynamic content, appear only when the mouse is pressed if(mousePressed){ fill(255,255,255,80); ellipse(mouseX-50,mouseY-50,400,400); rectMode(CENTER); fill(85,85,85,100); rect(mouseX,mouseY,200,200); fill(248,252,25,100); ellipse(mouseX+10,mouseY+10,30,30); } } void keyPressed(){ //changes the direction of all the movement bigOrangeCircleGrowthRate *= -1; bottomRightCornerGrowthRate *= -1; pinkCircleGrowthRate *= -1; greenSmallCircleGrowthRate *= -1; blueCircleRate *= -1; purpleCircleRate *= -1; greenDiagonalRate *= -1; smallPlumCircleRate *= -1; sunRate *= -1; }