//Create a new Slider Expression effect. I named it 'Score'
var num = effect("Score")("Slider");
num = Comma(num);
[num]
function Comma(number)
{
number = '' + Math.round(number);
if (number.length > 3)
{
var mod = number.length % 3;
var output = (mod > 0 ? (number.substring(0,mod)) : '');
for (i=0 ; i < Math.floor(number.length / 3); i++)
{
if ((mod == 0) && (i == 0))
output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
else
output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3);
}
return (output);
}
else return number;
}
Tuesday, November 28, 2017
Thursday, November 16, 2017
Limiting Decimal Places In Text Layers
Adding .toFixed(4) after the variable limits the decimal places to 4. ie 26.7835
Adding .toFixed(2) would limit the decimal places to 2. ie 26.78
.toFixed(3) would limit the decimal places to 3. ie 26.784 (note it rounds value)
ex: avgEQ = (thisComp.layer("1").transform.scale[1] + thisComp.layer("2").transform.scale[1])/2;
avgEQ.toFixed(4)
Adding .toFixed(2) would limit the decimal places to 2. ie 26.78
.toFixed(3) would limit the decimal places to 3. ie 26.784 (note it rounds value)
ex: avgEQ = (thisComp.layer("1").transform.scale[1] + thisComp.layer("2").transform.scale[1])/2;
avgEQ.toFixed(4)
Aligning Lens Flare To Target
In order to align the streak of the lens flare to a target, first create 2 nulls (LightTarget, LightSource)
Light Factory Location =
lSource = thisComp.layer("LightSource").transform.position;
lTarget = thisComp.layer("LightTarget").transform.position;
Anchor = transform.anchorPoint;
lSource-lTarget+Anchor
Light Factory's layer position =
thisComp.layer("LightTarget").transform.position
Make sure the solid layer that the lens flare is applied to is large enough for the comp.
Light Factory Location =
lSource = thisComp.layer("LightSource").transform.position;
lTarget = thisComp.layer("LightTarget").transform.position;
Anchor = transform.anchorPoint;
lSource-lTarget+Anchor
Light Factory's layer position =
thisComp.layer("LightTarget").transform.position
Make sure the solid layer that the lens flare is applied to is large enough for the comp.
Subscribe to:
Posts (Atom)