View all expressions
Randomness

Unique Snowflake Generator

A complex generative art script that uses branching algorithms to draw a unique, crystalline vector path. It uses the layer index as a random seed, meaning every duplicate of the layer will generate a completely different fractal design.

Contributed by:


seedRandom(index, true);
arms = 8;
radius = 100;
branchCount = Math.floor(random(3, 6));
armWidth = 5;
// Store shape of ONE arm (right side)
armProfile = [];
// Generate one arm
for (j = 1; j <= branchCount; j++) {
t = j / (branchCount + 1);
dist = t * radius;
currentWidth = armWidth * random(0.5, 1.5);
armProfile.push({x: currentWidth, y: -dist});
branchLen = random(20, 60) * (1 - t);
branchAngle = -Math.PI / 3;
bx = currentWidth + Math.cos(branchAngle) * branchLen;
by = -dist + Math.sin(branchAngle) * branchLen;
armProfile.push({x: bx, y: by});
armProfile.push({x: currentWidth, y: -(dist + 15)});
}
// Rotate helper
function rotatePoint(x, y, angle) {
ca = Math.cos(angle);
sa = Math.sin(angle);
return [x * ca - y * sa, x * sa + y * ca];
}
// Build full snowflake
pts = [];
for (i = 0; i < arms; i++) {
rotAngle = (i / arms) * Math.PI * 2;
// Right side
for (k = 0; k < armProfile.length; k++) {
 p = rotatePoint(armProfile[k].x, armProfile[k].y, rotAngle);
 pts.push(p);
}
// Main tip
tip = rotatePoint(0, -radius, rotAngle);
pts.push(tip);
// Left side (mirrored)
for (k = armProfile.length - 1; k >= 0; k--) {
 p = rotatePoint(-armProfile[k].x, armProfile[k].y, rotAngle);
 pts.push(p);
}
}
createPath(pts, [], [], true);

Unique Snowflake Generator

Practical use case

Perfect for winter-themed motion graphics where you need variety. Instead of using the same asset repeatedly, you can generate an infinite number of unique ice crystals instantly.

Check out similar expressions

Data-driven video workflows for After Effects are easier with Plainly.

a mesh of elegant lines transparent image