-
Scaling size restrictions including a failsafe for 0
I’m building a spreadsheet driven template. I use this expression to limit the size of a layer (often text,) but since there won’t always be data that fills this layer, sometimes the sourceRectAtTime will come back 0, which breaks the expression when it tries to divide by zero and turns it off for subsequent renders that will need it active. I figured I would have to include a conditional that if r==0 then it should have some arbitrary size like 100, but nothing I’ve tried is getting me results. Where/how would I add this?
maxW = thisComp.width*0.85;
maxH = thisComp.height*0.075;
r = sourceRectAtTime(time);
w = r.width;
h = r.height;
s = w/h > maxW/maxH ? maxW/w : maxH/h;
[100,100]*s;
any assistance would be greatly appreciated!