Skip to main content
Inspiring
September 5, 2021
Answered

add item to the layer at particular time

  • September 5, 2021
  • 1 reply
  • 327 views

Dear ae fellows,

I'm writing a simple script which imports a png sequence into the composition and adds it to the layers at a particular time (for example at the time where a time slider on a time track is positioned at the moment).

 

Is there a way to insert an item at a particulat time?

Right now, I'm only able to insert my sequence at t = 0

So far my code looks as follows

 

// ******** importing a sequence  into project**********************

var importOptions = new ImportOptions();
importOptions.file = new File(file);  // file is the first file in my png sequence
importOptions.sequence = true;
importOptions.forceAlphabetical = false;
var item = app.project.importFile(importOptions);

// ******** end of importing a sequence  into project**********************

 

var activeItem = app.project.activeItem;

//******** position of a time slider****************************

time = app.project.activeItem.time;

 

//************** here I add png sequence at time t = 0.
var solidLayer = activeItem.layers.add(item);

 

How would I add it at  t= time ?

Yaroslav.

This topic has been closed for replies.
Correct answer Dan Ebberts

Like this:

var solidLayer = activeItem.layers.add(item);
solidLayer.startTime = t;

1 reply

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
September 5, 2021

Like this:

var solidLayer = activeItem.layers.add(item);
solidLayer.startTime = t;
Inspiring
September 5, 2021

Thank you, Dan!