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

percentage range to opacity

Community Beginner ,
Aug 17, 2021 Aug 17, 2021

Hi all, 

I have a static range of percentages I want to convert the opacity of a specific layer with. Each frame has a different opacity, 504 frames. How do I add those? It shouldn't be hard I think, but I just need a bit of code I think? 

Here is an example range:

 

70%77%81%84%86%86%86%86%86%87%87%87%87%87%87%87%87%87%87%86%86%86%86%86%86%86%86%86%86%86%86%86%86%86%86%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%85%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%84%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%83%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%82%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%81%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%80%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%79%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%78%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%77%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%76%75%75%75%75%75%75%75%75%75%75%75%75%75%75%75%

 

TOPICS
Expressions , How to , Scripting
299
Translate
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 ,
Aug 25, 2021 Aug 25, 2021

You can make a JSON file like the ones attached that places all the opacity values in an array. Import that file into After Effects and place it at the bottom of your comp. Then on your layer's opacity property, add the expression
[ UPDATED ]

 

thisComp.layer("opacity.json")("Data")("Outline")(timeToFrames(time) + 1)

 

which will grab the value in the array value for each frame (1st frame = 70%, 2nd frame = 77%, etc)

 

justintaylor_0-1629915385049.png

 

 

Translate
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 ,
Aug 25, 2021 Aug 25, 2021
LATEST

Thanks Rick, read that section wrong, updated the expression above.

Translate
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 ,
Aug 25, 2021 Aug 25, 2021

This looks like a nonlinear change in opacity. The easiest way is with a JSON file but you want to apply it to frames instead of layers.

 

If you want a specific linear change over time you can just use a simple expression like this:

 

t = time * thisComp.frameDuration;
tMin = 0;
tMax = 504;
value1 = 70;
value2 = 40;
linear(t, tMin, tMax, value1, value2);

 

 It would really help us help you if we knew the design goal you had. I'm having a hard time visualizing what you are trying to accomplish. There may be a lot simpler approach.

Translate
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