View all expressions
Randomness

Christmas Lights Color Generator

Randomly switches a layer's color between a defined holiday palette (Red, Green, Gold, White). It uses the layer's index to ensure multiple duplicates flash independently, creating a non-synchronized, organic blinking effect.

Contributed by:


// Palette Red, Green, Gold, White
colors = [
[0.8, 0, 0, 1],
[0, 0.5, 0, 1],
[1, 0.8, 0, 1],
[1, 1, 1, 1]
];
speed = 3; // Changes per second
idx = Math.floor(time * speed);
// Randomize based on layer index so lights don't sync
seedRandom(index + idx, true);
choice = Math.floor(random(colors.length));
colors[choice];

Christmas Lights Color Generator

Practical use case

Ideal for animating string lights, garlands, or festive borders where you need hundreds of individual bulbs to blink randomly without manually animating each one.

Check out similar expressions

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

a mesh of elegant lines transparent image