• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Community Beginner ,
Apr 10, 2023 Apr 10, 2023

Copy link to clipboard

Copied

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. 

TOPICS
Expressions

Views

167

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 10, 2023 Apr 10, 2023

I'd do it like this:

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

Votes

Translate

Translate
LEGEND ,
Apr 10, 2023 Apr 10, 2023

Copy link to clipboard

Copied

seedRandom(Math.floor(time/2);

random(0,100);

 

Mylenium 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 10, 2023 Apr 10, 2023

Copy link to clipboard

Copied

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

Any other ideas?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 10, 2023 Apr 10, 2023

Copy link to clipboard

Copied

LATEST

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

 

Mylenium 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2023 Apr 10, 2023

Copy link to clipboard

Copied

I'd do it like this:

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 10, 2023 Apr 10, 2023

Copy link to clipboard

Copied

That's it! Thank you!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines