Skip to main content
S_ A
Inspiring
Feb 26, 2025 9:20 PM UTC
Answered

How to write expression in such case - 12 (slowing random expression)

Hi,

I want this random expression to slow so that I can see the color change, I mean 1st color will stay for few seconds (Maybe 2/3 seconds), then the next color will also pause for some time, and then third color same...I want them to stay for few seconds before shifting to the next color. How can I slow it? what  should I write in the expression so that AE can make the color to stay for few seconds. Thank you

 

 

 

Dan Ebberts
Dan EbbertsCorrect answer
Community Expert
Feb 26, 2025 10:09 PM UTC

I'm not sure which method you're looking for, but if you just want to cycle through the colors, you could do something like this:

holdTime = 2; // hold each color for 2 seconds
a = effect("Color Control")("Color");
b = effect("Color Control 2")("Color");
c = effect("Color Control 3")("Color");
colors = [a,b,c];
idx = Math.floor(time/holdTime)%colors.length;
colors[idx]

but if you want to pick the colors randomly, it would be more like this:

holdTime = 2; // hold each color for 2 seconds
a = effect("Color Control")("Color");
b = effect("Color Control 2")("Color");
c = effect("Color Control 3")("Color");
colors = [a,b,c];
seed = Math.floor(time/holdTime);
seedRandom(seed,true);
idx = Math.floor(random(colors.length));
colors[idx]

 

 

 

 

2 replies

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
Feb 26, 2025 10:09 PM UTC

I'm not sure which method you're looking for, but if you just want to cycle through the colors, you could do something like this:

holdTime = 2; // hold each color for 2 seconds
a = effect("Color Control")("Color");
b = effect("Color Control 2")("Color");
c = effect("Color Control 3")("Color");
colors = [a,b,c];
idx = Math.floor(time/holdTime)%colors.length;
colors[idx]

but if you want to pick the colors randomly, it would be more like this:

holdTime = 2; // hold each color for 2 seconds
a = effect("Color Control")("Color");
b = effect("Color Control 2")("Color");
c = effect("Color Control 3")("Color");
colors = [a,b,c];
seed = Math.floor(time/holdTime);
seedRandom(seed,true);
idx = Math.floor(random(colors.length));
colors[idx]

 

 

 

 

Translate
S_ A
S_ AAuthor
Inspiring
Feb 27, 2025 6:03 AM UTC

You are the G.O.A.T= Greatest Of All Time

 

Thank you so much. 

Translate