Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions randomly applied opacity with a range

  • randomly applied opacity with a range

    Posted by Jason Jantzen on January 21, 2013 at 8:28 pm

    I know of one who probably looks at this like child’s play (Dan), but to me, the issues is confusing as all get up.

    I have 100’s of layers and need an opacity value applied randomly to each one. The range is 33% 65% 75% and 100%. My math is pretty rusty, but I was just thinking that more than 2 numbers isn’t a range anymore, is it? Anyway, I would very much appreciate some help on this one.

    Jason Jantzen
    vimeo.com/jasonj

    Jason Jantzen replied 13 years, 3 months ago 3 Members · 5 Replies
  • 5 Replies
  • Kevin Camp

    January 21, 2013 at 8:47 pm

    just a few questions….

    first, do you want a given layer’s opacity to animate randomly between those values, or just randomly set the opacity to a value between those values (so it sets it to say 33% and it stays that way though out).

    second, do you just want the opacity to be set to one of those 4 values, or can it be set to values between those values (like 40% since that’s between 33-65%). i assume it’s one of those four values, but i wasn’t clear on that…

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Jason Jantzen

    January 21, 2013 at 9:00 pm

    I want the opacity to stay the same throughout the comp, no random animation.

    and if it’s possible, make the opacity value one of those 4 values, but of course random from one layer to the next, and no in between values like 40%. This is a request from a Microsoft client if that gives you any idea how weird the request is.

    Thanks Kevin!

    Jason Jantzen
    vimeo.com/jasonj

  • Dan Ebberts

    January 21, 2013 at 9:14 pm

    An opacity expression like this should work:

    choices = [33,65,75,100];
    seedRandom(index,true);
    choices[Math.floor(random(choices.length))]

    You can apply it to one layer, select the Opacity property then

    Edit > Copy Expression Only

    select all the other layers

    Edit > Paste

    Dan

  • Kevin Camp

    January 21, 2013 at 9:15 pm

    try this

    vals = [33,65,75,100];
    seedRandom(index,true);
    r = Math.floor(random(0,3.999));
    vals[r]

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Jason Jantzen

    January 21, 2013 at 9:24 pm

    thanks guys, both work perfectly. I’m sort of not surprised that nobody’s asked to do something like this. it’s always blinking, flickering, or some other animation.

    this saves me a TON of time!

    Jason Jantzen
    vimeo.com/jasonj

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy