FORUMS: list search recent posts

Controlling layer in and out points from timecode in a JSON database

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jonathan Bierman
Controlling layer in and out points from timecode in a JSON database
on Feb 27, 2019 at 8:01:26 pm

Hello there, hope someone can help...

I am making 30 x 1h animated videos for DJ "mixtapes" for the Youtubes. These videos need to display the artist name and song title of the currently playing track. I have a spreadheet with all the data I need: start time, end time (hh:mm:ss:ff), artist, title. These spreadsheets are exported from Google Sheets as a JSON file which can be loaded into an AE comp. Then, I pickwhip the Source Text field of the text layers to the appropriate field in the JSON layer and Voila! my text is correct. Now I can swap out the JSON file for a different one and BAM I have new track data. I havge one problem, I can't figure out how to automate their in and out points.. these text layers have a linear time-based expression on their opacity to make them fade in and out, which I want to keep:

Math.min(linear(time,inPoint,inPoint + fadeInTime,0,100),linear(time,outPoint - fadeOutTime,outPoint,100,0))

Any ideas?


Return to posts index

Jonathan Bierman
Re: Controlling layer in and out points from timecode in a JSON database
on Feb 27, 2019 at 8:41:17 pm

I actually got a solution from elsewhere so no need to put time into this, but if anyone is interested, this script solved my issue, although it does not trim the in and out points, it changes the opacity of the layer at a certain point in the comp:

t = thisComp.layer("HMS05 Erski.json")("Data")("Outline")("Sheet1")("Sheet1 0")("in");

var f = 0;
for(i=0; i<4; i++){
d = t.split(":")[i];
try{d = d.split(":")[0]}catch(e){};
f += parseInt(d);
if(i<2) f*=60;
if(i==2)f*=(1/thisComp.frameDuration);
}

s = thisComp.layer("HMS05 Erski.json")("Data")("Outline")("Sheet1")("Sheet1 0")("out");

var g = 0;
for(i=0; i<4; i++){
d = s.split(":")[i];
try{d = d.split(":")[0]}catch(e){};
g += parseInt(d);
if(i<2) g*=60;
if(i==2)g*=(1/thisComp.frameDuration);
}

if(time < (framesToTime(f) + framesToTime(g))/2){
ease(time,framesToTime(f),framesToTime(f)+1,0,100);
}else{
ease(time,framesToTime(g)-1,framesToTime(g),100,0)
};


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]