Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions If/else multiple expression

  • If/else multiple expression

    Posted by Aniello Ferrone on November 17, 2019 at 8:43 pm

    Hi guys,

    Could you help me with this sum / if else expression?
    I think I did’nt insert one element correctly

    Thank you so much
    Aniello

    x = transform.anchorPoint[0];
    y = transform.anchorPoint[1];

    r1 = comp("Rigo 1").layer("Text 01");
    r2 = comp("Rigo 2").layer("Text 01");
    r3 = comp("Rigo 3").layer("Text 01");
    r4 = comp("Rigo 4").layer("Text 01");
    sum = (r1.text.sourceText.length?1:0) + (r2.text.sourceText.length?1:0) + (r3.text.sourceText.length?1:0) + (r4.text.sourceText.length?1:0);
    [x, y];

    if(sum == 2){
    [x, -296];
    }else {

    if(sum == 1){
    [x, -354];
    } else {

    if(sum == 3){
    [x, -270];

    else [x, -231];
    }

    Aniello Ferrone
    Viral Video Editor
    http://www.fanpage.it

    Dan Ebberts replied 6 years, 6 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    November 17, 2019 at 11:05 pm

    I’m not sure this is exactly what you’re trying to do, and I haven’t tested it, but I think I’d set it up more like this:

    r1 = comp(“Rigo 1”).layer(“Text 01”);
    r2 = comp(“Rigo 2”).layer(“Text 01”);
    r3 = comp(“Rigo 3”).layer(“Text 01”);
    r4 = comp(“Rigo 4”).layer(“Text 01”);
    sum = (r1.text.sourceText.length?1:0) + (r2.text.sourceText.length?1:0) + (r3.text.sourceText.length?1:0) + (r4.text.sourceText.length?1:0);
    s = clamp(sum,0,4);
    myArray = [value[1],-354,-296,-270,-231];
    y = myArray[s];
    [value[0],y]

    Dan

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