-
Just because I’m curious… Put an expression into a var
I realised I sometimes use an expression more than once in quite a few if/else statements. I’m just used to it being bulky, but never thought about putting the repeated expression into a variable.
a = 1;
fad = eval(“if (time < (inPoint + outPoint)/2){ease(time,inPoint,inPoint+a,0,100);} else 0;”)
if(thisLayer.name == “Station”){
fad;
} else 0;although this is just for testing purposes, this worked nicely.
but this doesn’t
a = 1;
fad = eval(“if (time < (inPoint + outPoint)/2){
ease(time,inPoint,inPoint+a,0,100);
} else 0;”)if(thisLayer.name == “Station”){
fad;
} else 0;I kinda know why it doesn’t work, but is there a way to make the second one work?…As it would be nice just to know how to in the future. I’ve seen a few possible ways that people have put, but I’ve had no success.