Duration of the next active layer.


nextActiveLayer = thisLayer;
for (i = thisLayer.index + 1; i <= thisComp.numLayers; i++) {
	if (thisComp.layer(i).active) {
		nextActiveLayer = thisComp.layer(i);
		break;
	}
}
duration = nextActiveLayer.outPoint - nextActiveLayer.inPoint;
timeToFrames(duration, fps = 1.0 / thisComp.frameDuration, isDuration = true)

Apply this expression to the Source Text property of a text layer at the top of a stack. The for loop in here iterates down from the top to find the first layer that is active and gets its duration.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s