Skip to main content
Inspiring
April 10, 2023
Answered

Expression help? Changing opacity and holding the value for 2 seconds

  • April 10, 2023
  • 2 replies
  • 475 views

I have a box (shape layer) that I want to change the opacity to a random number between 0-100, then hold that opacity value for 2 seconds, then change the opacity value again to another random value, and so on...
 
Any ideas where I could find a quick copy/paste expression? Thank you. 

This topic has been closed for replies.
Correct answer Dan Ebberts

I'd do it like this:

holdTime = 2;
seed = Math.floor((time - inPoint)/holdTime);
seedRandom(seed,true);
random(100);

2 replies

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
April 10, 2023

I'd do it like this:

holdTime = 2;
seed = Math.floor((time - inPoint)/holdTime);
seedRandom(seed,true);
random(100);
Inspiring
April 10, 2023

That's it! Thank you!

Mylenium
Legend
April 10, 2023

seedRandom(Math.floor(time/2);

random(0,100);

 

Mylenium 

Inspiring
April 10, 2023

Thank you, however, I am still seeing a new random opacity every frame. I also added another parentheses after (time/2)); 

Any other ideas?

Mylenium
Legend
April 10, 2023

Yeah, my bad. Damn auto-correct when typing on the tablet. 😉

 

Mylenium