Skip to content

Instantly share code, notes, and snippets.

@willsummers
willsummers / .jsx
Created October 27, 2025 17:43
Replace Multiple Expressions
var expr = 'value + [0, Math.sin(time * 2) * 50]'; // example expression
app.beginUndoGroup("Apply Expression");
var comp = app.project.activeItem;
if (comp && comp instanceof CompItem) {
for (var i = 0; i < comp.selectedLayers.length; i++) {
var layer = comp.selectedLayers[i];
layer.property("Transform").property("Position").expression = expr;
}
@willsummers
willsummers / Videowall Automagic
Created April 16, 2015 15:12
Not working the way I want it to.. look at this another time.
//Find Top most Layer Index
topStackIndex = function(){
for (i = 1; i <= thisComp.numLayers; i++){
if (i == index) continue;
my_layer = thisComp.layer(i);
if (! (my_layer.hasVideo && my_layer.active)) continue;
if (time >= my_layer.inPoint && time < my_layer.outPoint){
try{
return my_layer.index;
}catch(err1){
//KeyAllanimProps.jsx
// October 2013 Will Summers
//willsummers.wordpress.com
var proj = app.project
app.beginUndoGroup("Keyframe all Animation Properties")
if (proj) {
@willsummers
willsummers / AELayerDurationXP
Last active August 29, 2015 14:14
Duration of the next active layer After Effects Expression
//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.
nextActiveLayer = thisLayer;
for (i = thisLayer.index + 1; i <= thisComp.numLayers; i++) {
if (thisComp.layer(i).active) {
nextActiveLayer = thisComp.layer(i);
break;
}
}