Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions AECC2017 Script for “Slider to Opacity” trouble

  • AECC2017 Script for “Slider to Opacity” trouble

  • fabiano noli

    November 17, 2019 at 12:40 am

    Hi Community!

    I have a trouble with my script

    I use AEC2017 and I want that the opacity of my Precomp is “turned off” when my slider control is equal or less than 0,02

    So
    I used a Script of CreativeCow Brother that I found in this blog.
    And this script is:
    ctrl = thisComp.layer(“control”).effect(“Slider Control”)(“Slider”);
    if ( Math.floor( ctrl ) == 1 ) 100 else 0;

    In this case, with other value obviously, this script works great!
    And the mist started to disappear.

    But when I change that in this:
    ctrl = thisComp.layer(“Master”).effect(“Slider Control”)(“Slider”);
    if ( Math.floor( ctrl ) <= 0,02 ) 100 else 0;

    don’t works anymore

    Can You help me?
    Thank you for your time

    ps. I tried also these:
    -if(thisComp.layer(“Master”).effect(“Slider Control”)(“Slider”)<=0,02) 100 else 0
    -if(thisComp.layer(“Null 1”).effect(“Slider Control”)(“Slider”)<=0,02) 100; else 0
    -if(thisComp.layer(“Null 1”).effect(“Slider Control”)(“Slider”)<=1) { 100 }else{ 0 }

  • Dan Ebberts

    November 17, 2019 at 5:49 am

    Try this:

    ctrl = thisComp.layer(“Master”).effect(“Slider Control”)(“Slider”).value;
    ctrl <= 0,02 ? 100 : 0

    Note that I’m not sure about the 0,02 punctuation, here it would be 0.02

    Dan

  • fabiano noli

    November 17, 2019 at 5:18 pm

    Hi Dan,
    thanks for your time!
    Your script is great!
    It worked!!!
    🙂

  • Gonzalo Menevichian

    November 17, 2019 at 7:46 pm

    Hi Dan

    I pretty Newby on the expression script I have this line:

    (thisComp.layer(“Slider”).effect(“Slider Control”)(“Slider”).value >= 50) ? 0 : 100;

    That it work well but I would like to add “if is <=10 or =>50” then ? 0 : 100;
    How Could I do that?

    Thanks!
    G

  • Dan Ebberts

    November 17, 2019 at 8:02 pm

    Like this:

    s = thisComp.layer(“Slider”).effect(“Slider Control”)(“Slider”).value;
    (s <= 10 || s >= 50) ? 0 : 100;

    Dan

  • Gonzalo Menevichian

    November 17, 2019 at 8:08 pm

    OMG!
    It works!!!!

    Thank you so much!!!!

Viewing 1 - 6 of 6 posts

Log in to reply.

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