Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Range control by slider

  • Range control by slider

    Posted by Pavol Feješ on May 8, 2017 at 1:50 pm

    Hi guys
    I’m trying to find a way to define a range for calculating the maximum value using the slider. I have 3 layers to calculate and 1 layer that this calculation affects. Slider ranges from 1-3. If slider = 3, the layer value is the maximum z (n1, n2, n3). If slider = 2, the layer value is the maximum z (n1, n2). If the slider = 1, the layer value is the maximum z (n1). I do not know how to define the range of these values for the calculation. Does anyone have an idea?
    Thank you very much for your answers

    n1=thisComp.layer("01").sourceRectAtTime().width;
    n2=thisComp.layer("02").sourceRectAtTime().width;
    n3=thisComp.layer("03").sourceRectAtTime().width;

    max = Math.max(n1,n2,n3);

    Steve Sierra replied 9 years, 2 months ago 2 Members · 3 Replies
  • 3 Replies
  • Steve Sierra

    May 8, 2017 at 2:05 pm

    Hi,

    You can put this in your property :

    n1=thisComp.layer(“01”).sourceRectAtTime().width;
    n2=thisComp.layer(“02”).sourceRectAtTime().width;
    n3=thisComp.layer(“03”).sourceRectAtTime().width;
    s = effect(“Slider Control”)(“Slider”);

    if(s<33){
    max = Math.max(n1,n2,n3);
    }else{
    if(s>33 && s<66){
    max = Math.max(n1,n2);
    }else{
    max = Math.max(n1);
    }
    };

    Hope this works for you !
    😉

  • Pavol Feješ

    May 8, 2017 at 2:44 pm

    thank you Steve. but this was just an example. In fact, those layers are 44.

  • Steve Sierra

    May 8, 2017 at 3:12 pm

    I see…
    I’ll look into it, but it seems a bit complicated for me.

    I’ll keep you posted !
    Good luck 😉

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