Skip to content

Instantly share code, notes, and snippets.

@MarissaJ
MarissaJ / Add Commas in Adobe After Effects with Javascript
Last active August 24, 2022 02:12
Add Commas Javascript Global Replace function
total=text.sourceText;
function formatNumber(total) {
return total.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,')
}
formatNumber(total)
@MarissaJ
MarissaJ / counting-up-after-effects-two-commas
Created November 11, 2019 16:23
Animate Numbers Counting up with One Comma in After Effects
start=parseInt(thisLayer.text.sourceText="0");
end=parseInt(text.sourceText);
val=Math.round(easeOut(time, startTime, 2,start, end));
s=""+ val;
if (s.length > 6){
s.substr(0, s.length -6) + "," + (s.substr(1, s.length -4) + "," + s.substr(-3));
}else{
if (s.length > 3){
s.substr(0, s.length -3) + "," + s.substr(-3);
}else{
@MarissaJ
MarissaJ / counting-up-after-effects-one-comma
Created November 11, 2019 16:22
Animate Numbers Counting up with One Comma in After Effects
start=parseInt(thisLayer.text.sourceText="0");
end=parseInt(text.sourceText);
val=Math.round(easeOut(time, startTime, 2,start, end));
s=""+ val;
if (s.length > 3){
s.substr(0, s.length -3) + "," + s.substr(-3);
}else{
s
}
@MarissaJ
MarissaJ / counting-up-after-effects-basic
Created November 11, 2019 16:18
Animate Numbers Counting Up in After Effects
start=parseInt(thisLayer.text.sourceText="0");
end=parseInt(text.sourceText);
val=Math.round(easeOut(time, startTime, 4,start, end));
@MarissaJ
MarissaJ / sort-text-with-corresponding-number-data.js
Created November 20, 2018 22:57
After Effects 2019 Data-driven Expression- Sort text with corresponding number data
var examples = [
{
'text' : thisComp.layer("Data-Driven-Sample.csv")("Data")("Outline")("Text Data")("Text Data 0"),
'number' : parseInt(thisComp.layer("Data-Driven-Sample.csv")("Data")("Outline")("Number Data")("Number Data 0"))
},
{
'text' : thisComp.layer("Data-Driven-Sample.csv")("Data")("Outline")("Text Data")("Text Data 1"),
'number' : parseInt(thisComp.layer("Data-Driven-Sample.csv")("Data")("Outline")("Number Data")("Number Data 1"))
},
{
@MarissaJ
MarissaJ / sort-column-numbers-ascending.js
Created November 20, 2018 22:51
After Effects 2019 Sort Column Numbers Ascending
values = [];
for(i=0;i<=thisComp.layer("Data-Driven-Sample.csv")("Data")("Number of Rows")-1;i++) {   
  values.push(thisComp.layer("Data-Driven-Sample.csv")("Data")("Outline")("Number Data")("Number Data " + i).value);
} values.sort((a, b) => a - b);
@MarissaJ
MarissaJ / sort-column-numbers-descending.js
Created November 20, 2018 22:50
After Effects 2019 Sort Column Numbers Descending
values = [];
for(i=0;i<=thisComp.layer("Data-Driven-Sample.csv")("Data")("Number of Rows")-1;i++) {   
  values.push(thisComp.layer("Data-Driven-Sample.csv")("Data")("Outline")("Number Data")("Number Data " + i).value);
} values.sort((a, b) => b - a);
@MarissaJ
MarissaJ / color-hex-expression
Created November 20, 2018 22:49
After Effects 2019 Color Hex Value Expression
colorText=thisComp.layer("Data-Sample.csv")("Data")("Outline")("Color Data")("Color Data 0").toString();
hexToRgb(colorText);
@MarissaJ
MarissaJ / last-value-in-column.js
Created November 20, 2018 22:43
Get the last entry in a column
rows =thisComp.layer("Data-Sample.csv")("Data")("Number of Rows")+1;
last_val= 0;
for(i=0;i<rows;i++) { if(thisComp.layer("Data-Sample.csv")("Data")("Outline")("Number Data")("Number Data " + i))
{
Math.max(last_val= thisComp.layer("Data-Sample.csv")("Data")("Outline")("Number Data")("Number Data " + i)); } } last_val;
@MarissaJ
MarissaJ / data-row-number.js
Last active August 24, 2022 02:11
After Effects Data Driven Expressions- Display Data Based on Row Number
n=Math.round(thisComp.layer("Data-Sample.csv")("Data")("Number of Rows"));
values = [];for(i=n-1;i<=n-1;i++)
{     values.push(thisComp.layer("Data-Sample.csv")("Data")("Outline")("Text Data")("Text Data " + i).value); }
values;