Skip to main content
S_ A
Inspiring
February 26, 2025
Answered

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

  • February 26, 2025
  • 1 reply
  • 355 views

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

 

 

 

Correct answer Dan Ebberts

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]

 

 

 

 

1 reply

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
February 26, 2025

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]

 

 

 

 

S_ A
S_ AAuthor
Inspiring
February 27, 2025

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

 

Thank you so much.