Oops, I didn't get the memo about snowflakes. My seasonal offering is a little different.
//allonestring
float top;
float base;
float tWidth;
float tConstant;
int numWorms = 13;
float[]xpos = new float[numWorms];
float[]ypos = new float[numWorms];
float[]angle = new float[numWorms];
float[]speed = new float[numWorms];
color[]colours = new color[numWorms];
color[]inColours = new color[numWorms];
color[]outColours = new color[numWorms];
float[]lengths = new float[numWorms];
float[]widths = new float[numWorms];
int[]shapes = new int[numWorms];
color bgColour = color(random(217, 255), random(217, 255), random(217, 255));
void setup()
{
size(500, 500);
background(127);
noStroke();
top = height / 6;
base = 5 * height / 6;
tWidth = width / 5;
tConstant = (width - 2 * tWidth) / (2 * (top - base));
for(int i = 0; i < numWorms; i++)
{
xpos[i] = int(random(width));
ypos[i] = int(random(height));
angle[i] = random(0, 1);
speed[i] = random(0.3, 0.7);
inColours[i] = color(int(random(128)), int(random(128, 255)), int(random(128)));
outColours[i] = color(int(random(217, 255)), int(random(217, 255)), int(random(217, 255)));
lengths[i] = random(5, 70);
widths[i] = random(70 - lengths[i]);
if(abs(lengths[i] - widths[i]) < 10)
{
shapes[i] = 1;
}
else
{
shapes[i] = 0;
}
}
}
void draw()
{
for(int w = 0; w < numWorms; w ++)
{
worm(w);
}
}
void worm(int w)
{
angle[w] += random(-0.3, 0.3);
xpos[w] += cos(angle[w]) * speed[w];
ypos[w] += sin(angle[w]) * speed[w];
pushMatrix();
translate(xpos[w], ypos[w]);
rotate(angle[w]);
//shape boundary checking
if((top <= ypos[w]) && (ypos[w] <= base))
{
float leftSlope = width / 2 + tConstant * (ypos[w] - top);
float rightSlope = width / 2 - tConstant * (ypos[w] - top);
// println(xpos[w]);
if((leftSlope <= xpos[w]) && (xpos[w] <= rightSlope))
{
colours[w] = inColours[w];
}
else colours[w] = outColours[w];
}
else colours[w] = outColours[w];
//screen edge checking
if((ypos[w] > height) || (ypos[w] < 0))
{
ypos[w] = random(height);
xpos[w] = random(width);
}
if((xpos[w] > width) || (xpos[w] < 0))
{
ypos[w] = random(height);
xpos[w] = random(width);
}
fill(colours[w], random(10));
if(shapes[w] == 0)
{
ellipse(1, -1, widths[w], lengths[w]);
}
else
{
triangle(0, -widths[w] / 2, lengths[w], 0, 0, widths[w] / 2);
}
popMatrix();
}