/*
circle02: "addiction". it follows you
circle01: you are circle 01, and you are running from addiction
if addiction gets close, first you become excited,
and then when addiction is too close, you will become drugged
circle03: high circle gets happier(bigger) as addiction nears you
circle03 is very confused. sometimes it tries to follow you,
but sometimes gets paranoid and runs off
press mouse to add color
*/
float x = 0.0;
float y = 0.0;
float x2 = 0.0;
float y2 = 0.0;
float x3 = 0.0;
float y3 = 0.0;
float easing = 0.005;
float easing2 = 0.0099;
float max_distance;
void setup()
{
size(400,400);
smooth();
noStroke();
colorMode(HSB);
frameRate(60);
max_distance = dist(0,0,width, height);
noCursor();
}
void draw()
{
background(0);
float targetX = mouseX;
float targetY = mouseY;
float r = random(0,2);
x += (targetX-x)* easing;
y += (targetY-y)* easing;
x2 += (targetX-x)*easing;
y2 += (targetY-y)*easing;
x3 += (targetX-x)*easing2;
y3 += (targetY-y)*easing2;
//if statement makes it so when circle2 gets near circle1, circle 1 starts shaking also
//if the two unite, then they both start dialating
float d = dist(x2,y2,mouseX,mouseY);
for(int i=0; i<50; i=i+2)
{
fill(255,100-i+d/20);
ellipse(x3,y3,30+i-d/5,30+i-d/5);
}
//when mouse is pressed, gives circles additional quality of color
if(mousePressed==true)
{
stroke(random(120,130),300,300,50);
//circle01
ellipse(mouseX+random(10), mouseY+random(10), 60, 60);
//circle that follows
ellipse(x2+random(10,20), y2+random(10,20), 60, 60);
//circle02
//ellipse(x+random(50), y+random(50), 60, 60);
}
else if(d>75)
{
//circle01
ellipse(mouseX, mouseY, 60, 60);
//circle02
ellipse(x2+random(10,20), y2+random(10,20), 60, 60);
}
else if (d<30)
{
for(int k=10; k<=80; k=k+1)
{
fill(255,5);
ellipse(mouseX,mouseY,k+r,k+r);
}
for(int k=10; k<=80; k=k+1)
{
fill(255,5);
ellipse(x2,y2,k+r,k+r);
}
}
//when mouse isnt pressed
else
{
if(d<75 && d>30)
{
noStroke();
fill(255);
//circle01
ellipse(mouseX+random(10), mouseY+random(10), 60, 60);
//circle that follows
ellipse(x2+random(10,20), y2+random(10,20), 60, 60);
//circle02
fill(255);
}
else if(d>75)
{
fill(255);
//circle01
ellipse(mouseX, mouseY, 60, 60);
//circle02
ellipse(x2+random(10,20), y2+random(10,20), 60, 60);
}
else if (d<30)
{
for(int k=60; k<=80; k=k+1)
{
fill(255,100-6*k);
ellipse(mouseX,mouseY,k+r,k+r);
}
for(int k=60; k<=80; k=k+1)
{
fill(255,100-6*k);
ellipse(x2,y2,k+r,k+r);
}
}
//the closer circle02 gets to circle01, the more circle03 dialates. exciting to have fellow addicted friend
}
}
Exercise 08: Give three circles unique personalities through their qualities of response. For example, one circle can be frightened of the mouse and another affectionate. One circle can become curious about the mouse when it is pressed, but pay no attention otherwise.