ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

If/else array problem

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
aniello ferrone
If/else array problem
on Dec 8, 2019 at 12:20:38 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


Return to posts index

Dan Ebberts
Re: If/else array problem
on Dec 8, 2019 at 3:36:28 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



Return to posts index

aniello ferrone
Re: If/else array problem
on Dec 9, 2019 at 4:13:34 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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]