Forums › Adobe After Effects Expressions › [HELP] Script – Sequence Layers based on the bottom (or TOP) selected layer’s
-
[HELP] Script – Sequence Layers based on the bottom (or TOP) selected layer’s
-
Vincenzo Imbimbo
December 28, 2021 at 11:24 pmHi, i’m trying to create a Script to sequence the layers and so far so good but i have a problem and it is that the layers get sequenced based on my CTI (Current Time Indicator – Playhead), and that’s NOT what i want, i want the layers to be sequenced based on the start of the BOTTOM layer if it’s going to be like an stairs going up, or based on the start of the TOP layer if it’s going to be like an stairs going down, anyone can help me?, here is the code:
this.sequence = function (pal)
{
try
{
var comp = app.project.activeItem;
var err = this.selErr;
if (this.checkActiveItem(comp)) throw(err);var selLayers = comp.selectedLayers.reverse();
if (selLayers.length < 1) throw(err);
var offset = parseFloat(pal.gr.gr2.framesEt.text) * comp.frameDuration;
app.beginUndoGroup(this.scriptTitle);
for (var i = 0; i < selLayers.length; i++)
{
selLayers[i].startTime = comp.time + i * offset;
}
app.endUndoGroup();}
catch(err)
{
utils.throwErr(err);
}
};
this.run = function (thisObj)
{
this.buildUI(thisObj);};
}
Log in to reply.