After Effects Expressions 505 - Conditional Statements

Поділитися
Вставка
  • Опубліковано 31 лип 2024
  • Get the Course Materials: gum.co/animoplex-expressions
    World of Expressions - Full Playlist: • World of Expressions -...
    0:00 - Intro
    0:18 - Operators
    1:46 - If Statements
    2:22 - If...Else If Statement
    2:47 - If...Else If...Else Statement
    3:16 - Ternary Operator
    4:09 - Wrap Up
    View Course: www.animoplex.com/learn/expre...
    If you enjoy this expressions course, consider purchasing the paid content! It includes in-depth documentation, extra tutorial content, high definition video files, and project files used in the training. Your purchase will fund the release of this free course online for everyone to enjoy. Your support is greatly appreciated, and you’re helping to build more free courses like this in the future!
    For additional questions and help, reporting issues, or to share examples of how you used the World of Expressions tutorials, please email support@animoplex.com or post in the comments below.
  • Фільми й анімація

КОМЕНТАРІ • 15

  • @cath0dictube
    @cath0dictube 2 роки тому +1

    can't believe i've put off learning expressions because they seemed impossible, yet you were here all this time doing an excellent job explaining them! thank you for this series

    • @Animoplex
      @Animoplex  2 роки тому +1

      So glad you found this series! Expressions are very attainable, just start with simple expressions and move forward when you feel like you understand how it works. Reach out if you have any questions.

  • @kantravel5258
    @kantravel5258 3 роки тому +1

    I want to thank you for your great tutorials!

    • @Animoplex
      @Animoplex  3 роки тому +1

      Thank YOU for the kind words. And for watching!

  • @nitinmankar4705
    @nitinmankar4705 9 місяців тому

    I tried to changing color depend on shape moving (x,Y) but not working ;(
    I did it only in X position
    >
    var Black = [0,0,0,255]/255;
    var CloudyGray = [109,105,104,255]/255;
    var SmokeyGray = [114,110,109,255]/255;
    var White = [255,255,255,255]/255;
    if(thisComp.layer("Select Color").transform.xPosition

  • @je4a301
    @je4a301 4 роки тому +1

    Hey, to be honest, I'm new with expressions. I've got a question. Is it possible to make an expression for "if there is color 1 at one point then play composition 1 or 2 or 3 or 4 or 5 with the anchorpoint based on this point"? This would really help me, thank you.

    • @Animoplex
      @Animoplex  4 роки тому

      Good question! Do you know the X and Y locked position of the point you're trying to measure? Or is this a dynamic position that you're wanting the composition to re-center to?

    • @je4a301
      @je4a301 4 роки тому +1

      @@Animoplex In my case, it'd be a locked position. How do you think would an expression like this constructed and how to you make the software to choose by coincidience?

    • @Animoplex
      @Animoplex  4 роки тому

      Seems like a combo of if else statements applied to time remap on a master composition (with all of the other compositions inside) would do the trick. You're trying to trigger pre-comp animations based on a specific color value at a specific X and Y value at a specific time?

    • @je4a301
      @je4a301 4 роки тому

      @@Animoplex Exactly

  • @xdim
    @xdim 5 років тому +1

    Hi great Tutorials I learn A lot. maybe can you sugets a solution for this problem I have:
    I am creating a very complex project base in data from a Json file.
    And I need to link 7 precomps to a specific location on my composition base into 7 nulls I Already locate.
    I try to use If/else staments to link each layer to a specific null. But when some of the slides value is greater than the last one the code does't move the layer to the next null position. here is the code for "A" precomp.
    on "A" layer position expresion I wrote:
    A= thisComp.layer("Shape Layer 1").effect("1")("Slider");
    B= thisComp.layer("Shape Layer 1").effect("2")("Slider");
    C=thisComp.layer("Shape Layer 1").effect("3")("Slider");
    D=thisComp.layer("Shape Layer 1").effect("4")("Slider");
    E=thisComp.layer("Shape Layer 1").effect("5")("Slider");
    F=thisComp.layer("Shape Layer 1").effect("6")("Slider");
    G=thisComp.layer("Shape Layer 1").effect("7")("Slider");
    if (((A>B&&A>C) && (A>D&&A>E))&& (A>F&&A>G)){thisComp.layer("N_1").transform.position};
    else if (((AC) && (A>D&&A>E))&& (A>F&&A>G)){thisComp.layer("N_2").transform.position};
    else if (((AE))&& (A>F&&A>G)){thisComp.layer("N_3").transform.position};
    else if (((AG)){thisComp.layer("N_4").transform.position};
    else if (((AC && (B>D&&B>E))&& (B>F&&B>G)){thisComp.layer("N_2").transform.position};
    else if (((B>D&&B>E))&& (B>F&&B>G)){thisComp.layer("N_3").transform.position};
    else if (((B>E))&& (B>F&&B>G)){thisComp.layer("N_4").transform.position};
    else if ((B>F&&B>G)){thisComp.layer("N_5").transform.position};
    else if (B>G){thisComp.layer("N_6").transform.position};
    else if (B

    • @Animoplex
      @Animoplex  5 років тому +1

      Thanks for reaching out! Can you explain what the 7 individual Slider Controls are doing? Having a hard time understanding what level of control you need over this expression and the desired output. Feel free to reply here or send an email: hello at animoplex dot com

    • @Animoplex
      @Animoplex  5 років тому +1

      As a quick note in the meantime, you can try something simpler:
      src = thisComp.layer("Control");
      s = Math.floor(src.effect("Selector")("Slider"));
      thisComp.layer("N_" + s).transform.position
      Basically, this is looking for a Control layer, then at the value of a single Slider Control called Selector. The second line is rounding that value down to the nearest whole number to avoid decimals. The real magic is on the third line, which looks in the current composition for a layer with a name that matches "N_#" using the value of the slider. If you wanted to add more layers beyond 7, it requires no extra work. You can add some extra features and error fallbacks if needed, up to you. Not sure if this solves your original issue, but it may point you in the right direction.

    • @xdim
      @xdim 5 років тому +1

      Thanks for the reply and the code. but is a little diferent.
      In my comp I have:
      7 precomp with a porcentual number linked to then from a json file;
      7 nulls to link their position to my 7 precomps.
      And a shape layer with 7 sliders controls effects linked to my json data.
      The code I wrote works. But when for example the "C" slider is bigger than "B" the precomp located on N_2 moves to N_3 position, but the other comp do not changes itself to N_2 position; but if "C" becomes the bigest number it becomes N_1 position.
      My goal is to auto arrange my precomps from the biggest to the smallest percentage. Maybe i'm doing all wrong. Thanks again

    • @Animoplex
      @Animoplex  5 років тому +1

      Look for a reply via email, but here's a quick breakdown of the solution:
      src = thisComp.layer("Control");
      a = src.effect("1")("Slider");
      b = src.effect("2")("Slider");
      c = src.effect("3")("Slider");
      arr = [a, b, c];
      arr.sort(function(a, b){return a - b});
      num = arr[0].propertyGroup().name;
      thisComp.layer("Null " + num).transform.position
      This code is looking at the values for all three Sliders and creating an array with them. The array is then sorted numerically to determine the right order. Finally, a single array index is selected, which then finds the corresponding Null and matches the position of that layer. The project file is included in the email, best of luck!