//So some advice I got when learning Unity this summer was to simply name variables something that evokes their
//purpose but I apologize in advance if my freudian brain definitions make no sense in english.
//Rectangles
//amount of rectangles to be drawn
int rectCount = 100;
//arrays for setting the position of the rectangles
float[] rectPosX;
float[] rectPosY;
//rate that the rectangles will tremble
float rectWander = .2;
//colours for the background
int[] bColour = new int[3];
//colour range
int negativeLimit = 240;
int positiveLimit = 255;
//Arc shape
//arc rotation
float arcMotion;
//Vein graphics
//ammount of veins to be drawn
int veinCount = 30;
//arrays for the positions of the circle trails
float[] veinPosX;
float[] veinPosY;
void setup()
{
size(1000, 800);
background(200);
//initiates the starting positions of the squares and circle trails
squareSetup();
veinSetup();
}
void draw()
{
//draw the background
drawBackground();
//draw veins
drawVeins();
//draw Rectangles
drawSquares();
//draw center arc
polarShape();
}
//Setup functions
//set the positions of all the squares inside the array
void squareSetup()
{
//set the size of the arrays for the rectangle positions
rectPosX = new float[rectCount];
rectPosY = new float[rectCount];
//set each value in the array to a random position
for (int a = 0; a< rectCount; a++)
{
rectPosX[a] = random(0, width);
rectPosY[a] = random(0, height);
}
}
void veinSetup()
{
//set the position arrays to set amount
veinPosX = new float[veinCount];
veinPosY = new float[veinCount];
//set random X positions
for (int a = 0; a < veinCount; a++)
{
//set x positions randomly along screen width
veinPosX[a] = random(0, width);
//set y positions randomly below screen with some offset
veinPosY[a] = random(height, height + height/2);
}
}
//DrawFunctions
//change the background colour
void drawBackground()
{
//change the value for each colour
for (int a = 0; a < bColour.length; a ++)
{
//make the colour values change at random
bColour[a] += int(random(-3, 3));
//add or subtract the colour values if they fall out of
//set range
if (bColour[a] < negativeLimit)
{
bColour[a] = negativeLimit;
}
if (bColour[a] > positiveLimit)
{
bColour[a] = positiveLimit;
}
}
//manually limit a colour's range outside of automated loop
bColour[1] -= 10;
//draw the background
fill(bColour[0], bColour[1], bColour[2], 7);
rect(0, 0, width, height);
}
//draw the squares
void drawSquares()
{
noStroke();
fill(150, 150, 150);
//draw all of the rectangles with their set locations
for (int a = 0; a < rectCount; a ++)
{
//draw rectangles
rect(rectPosX[a], rectPosY[a], 50, 80);
//make the rectangles tremble
rectPosX[a] += random(-rectWander, rectWander);
rectPosY[a] += random(-rectWander, rectWander);
}
}
void polarShape()
{
//rotating arc shape
fill(255, 220, 175);
arc(width/2, height/2, 300, 300, radians(arcMotion*2), radians(arcMotion*2 + 90));
//bottom pulse circle
fill(180, 120, 300);
ellipse(width/2, height/2, 250 * cos(arcMotion*.01), 250* cos(arcMotion*.01));
//top pulse circle
fill(100, 100, 300);
ellipse(width/2, height/2, 250 * sin(arcMotion*.01), 250*sin(arcMotion*.01));
//rotate the arc shape
arcMotion +=2;
}
//draw trailing circles that move upwards
void drawVeins()
{
//Im not sure why im commenting these functions still it's pretty hard to forget them at this point
fill(200, 100, 150);
//draw all the circles
for (int a = 0; a < veinCount; a ++)
{
//draw the circles
ellipse(veinPosX[a], veinPosY[a], 10, 10);
//make the circle trail wander
veinPosX[a] += random(-3, 3);
//make the circles move upwards towards the origin;
veinPosY[a] -=3;
//if the trails rise above the screen reset them randomly
if(veinPosY[a] < 0)
{
veinPosY[a] = random(height, height + height/2);
}
}
}