Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions If/else array problem

  • If/else array problem

  • aniello ferrone

    December 8, 2019 at 12:20 pm

    Hi Masters,

    I can’t understand why this array is not working. It’s always on the “else” value.
    I tried to be very specific but it seems to go in contrast.

    Can you help me?

    Thank you so much

    r1 = comp("Rigo 1").layer("Text 01").text.sourceText;
    r2 = comp("Rigo 2").layer("Text 01").text.sourceText;
    r3 = comp("Rigo 3").layer("Text 01").text.sourceText;
    r4 = comp("Rigo 4").layer("Text 01").text.sourceText;
    r5 = comp("Rigo 5").layer("Text 01").text.sourceText;

    if ((r1 >= 0) && (r2 == 0) && (r3 != 0) && (r4 != 0) && (r5 >= 0 )) {
    [0,-120.5];

    } else if ((r1 >= 0) && (r2 == 0) && (r3 == 0) && (r4 != 0) && (r5 >= 0)) {
    [0,-46.5];

    } else if ((r1 >= 0) && (r2 != 0) && (r3 != 0) && (r4 == 0) && (r5 >= 0)) {
    [0,-260.5];

    } else if ((r1 >= 0) && (r2 != 0) && (r3 == 0) && (r4 == 0) && (r5 >= 0)) {
    [0,-331.5];

    } else if ((r1 >= 0) && (r2 != 0) && (r3 != 0) && (r4 != 0) && (r5 >= 0)) {
    [0,188.5];

    } else if ((r1 >= 0) && (r2 == 0) && (r3 != 0) && (r4 == 0) && (r5 >= 0)) {
    [0,188.5];

    } else { [0,-188.5]; }

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

  • Dan Ebberts

    December 8, 2019 at 3:36 pm

    Try converting each of your r1 thru r5 variables to numbers, like this:

    r1 = parseInt(comp(“Rigo 1”).layer(“Text 01”).text.sourceText.value,10);

    Dan

  • aniello ferrone

    December 9, 2019 at 4:13 pm

    Thank you Dan,
    It doesn’t seems to fix it, I’m starting to think that there is something wrong with all that conditions, for example, this is working perfectly

    Thank you so much
    Aniello

    r1 = comp("Rigo 1").layer("Text 01").text.sourceText;
    r2 = comp("Rigo 2").layer("Text 01").text.sourceText;
    r3 = comp("Rigo 3").layer("Text 01").text.sourceText;

    //Se -||
    if ((r1 == 0) && (r2 != 0) && (r3 != 0)) {
    [0,-137];
    //Se --|
    } else if ((r1 == 0) && (r2 == 0) && (r3 != 0)) {
    [0,-30];
    //Se ||-
    } else if ((r1 != 0) && (r2 != 0) && (r3 == 0)) {
    [0,-339];
    //Se |--
    } else if ((r1 != 0) && (r2 == 0) && (r3 == 0)) {
    [0,-433];
    //Se |||, -|-, |-|
    } else { [0,-232]; }

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

Viewing 1 - 3 of 3 posts

Log in to reply.

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