That’s pretty much exactly what I did (if…then)!
I just thought it was kinda “untidy”. The whole point of the expression was to convert a value like this:
source value: -180 -90 0 90 180
output value: 0 -1 0 1 0
…in a linear way, not a sinusoidal way, before you say something like “sin(zR)!”! So I was wondering if there was any more elegant way to do it rather than:
zR=thisComp.layer("target").transform.zRotation;
if (zR >=0 && zR <=90)
{
linear(zR,0,90,0,1);
}
else if (zR > 90)
{
linear(zR,90,180,1,0);
}
else if (zR <0 && zR >= -90)
{
linear(zR,0,-90,-1,0);
}
else if (zR <-90)
{
linear(zR,-90,-180,0,-1);
}