Forum Replies Created

  • Thanks for the suggestions.

    The invisible all caps layer sourceRectAtTime workaround is what I went with, but I had to change the horizontal scale on the all caps text to 80% to get the lines to break in the same place. The diff constant code didn’t adjust the anchor point based on the number of lines in the text box; it kept the layer in the same place rather than shifting it vertically like I wanted. Perhaps I didn’t understand it thoroughly enough–my knowledge of expressions is self-taught with the aid of helpful forums like this one!

  • Al Edwards

    August 13, 2020 at 12:35 am in reply to: Can I nest if/else statements?

    Solved!

    I made two adjustments that fixed the expression:

    1) When I pick-whipped the menu effect, I had to add .value to the end.
    2) Apparently the index of the first menu item is 1, not 0. So I needed to put v==1, not v==0 to reference that first menu item.

    I will paste the working code below in case it’s helpful to anyone.

    Thanks for the help!

    v = thisComp.layer("Control Layer").effect("Dropdown Menu Control")("Menu").value;
    r = thisComp.layer("Layer 1").transform.rotation;

    output = 0;
    if (v == 1) {
    if (r < 45) {
    output = 100;
    }
    } else if (v == 2) {
    output = 100;
    }
    output;

    //This way of writing it works too:

    if (v == 1 && r < 45) {
    100;
    } else if (v == 2) {
    100;
    } else {
    0;
    }

  • Al Edwards

    August 12, 2020 at 11:52 pm in reply to: Can I nest if/else statements?

    Hi Filip,

    When I pasted your code into AE, I didn’t get any errors. However, for v==0, the opacity stays at 100 all the time, even when r>45. Also, for v==1, I’m getting 0 when it should be 100. (v==2 is 0 too, but that’s correct).

    It did the same thing with the code I used in my second attempt. No errors, but still not the expected outcome. Any ideas as to why this is happening?

    My JavaScript knowledge is a little hazy when it comes to debugging the more complicated stuff like this!

  • Oh duh, I just figured it out… I messed up the order-of-operations on the width calculation.

    Here’s the corrected code in case it helps someone else!

    -Al

    t = thisComp.layer("Text").sourceRectAtTime();
    t2 = thisComp.layer("Text 2").sourceRectAtTime();
    logo = thisComp.layer("Logo").sourceRectAtTime();
    w = Math.max(t.width, t2.width) / 2 + logo.width;
    h = t2.height / 2;
    l = t2.left;
    top = t2.top;

    [w + l + logo.width, h + top]; // Keeps rectangle aligned left

  • Al Edwards

    November 1, 2019 at 1:55 pm in reply to: Make a Text Box Resize to the Longer of 2 Text Layers

    Wonderful! It works as advertised. Thanks for your quick reply, Dan.

    Al

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