Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Controlling layer in and out points from timecode in a JSON database

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

    Posted by Jonathan Bierman on February 27, 2019 at 8:01 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?

    Jonathan Bierman replied 7 years, 2 months ago 1 Member · 1 Reply
  • 1 Reply
  • Jonathan Bierman

    February 27, 2019 at 8:41 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)
    };

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy