-
Syntax Change IF causes Problem – what am i missing?
Hello,
i just changed my project from the legacy-engine to java script. I got most syntac issues fixed.
But one IF/ELSE statement wich worked fine, just won´t run. Can someone help me to fix the problem.I have two sliders (w1 & w2) with two values (like 0-100) which i want to compare, and a third slider to control the animation. If one value is bigger/smaller than the other it should play the animation of the third slider (Trend_Pfeil1) via the linear-function.
In legacy it was quite an easy code, and worked without any problems. But since the change to java i just can´t get it to run. And i think i just missed a little thing, and i am really a beginner at scripting
I tried only the “else”- statement without condition, change other things, the last idea was to try it with an “else if”. But i get an error message that translates to: “the expression uses an non defined value (maybe your subscript of the array is out of the valid range)”.
i tried to round the slider values with “Math.round()” or use “parseInt” because i thought maybe it is a problem with the values that are used. Or has it to do that the use of degrees with minus-numbers causes problems. Hope someone can tell me what i am missing.
w1 = thisComp.layer("Werte_Speicher").effect("Durschnitt W1")("Schieberegler");
w2 = thisComp.layer("Werte_Speicher").effect("Durschnitt W2")("Schieberegler");
rotate_arrow = -90;
if (w1 < w2){ rotate_arrow =linear(thisComp.layer("Werte_Speicher").effect("Trend_Pfeil1")("Schieberegler"),0,100,-90,-135); rotate_arrow; } if (w1 > w2){ rotate_arrow = linear(thisComp.layer("Werte_Speicher").effect("Trend_Pfeil1")("Schieberegler"),0,100,-90,-45); rotate_arrow; } else if(w1 == w2){ rotate_arrow; };