AE Expression: change properties on a certain layer from detecting other layer names or colors
Hey swarm!
I have one greenscreen video file cut into seperate layers using the scene detection function - as this sequence is final cut that has been cut from 5 different camera views before I now have the file split. My goal is to name the layers corresponding to the 5 different cam views like CLOSEUP, TOTAL, WIDE, etc.
after keying all those cuts are transparent and I want to add a backdrop that fits SCALE and POSITION paramerters of the camera views. now I sure could set holdkeyframes at every over 100!!) cut, but my goal is to give the POS and SCALE parameters an expression to detect the layer name or layer color to set the parameters at the next cut. I asked chatgpt to write such a script, but this just set the parameters for the last cut before the backdrop layer over the whole timeline. setting the scene detection to create pre-comps for each cut didnt work either - find the expression followed below:
// Define scale values for each camera angle
var scaleValues = {
"wide": [100, 100], // Scale for Camera 1
"english": [120, 120], // Scale for Camera 2
"halfclose": [146, 146], // Scale for Camera 3
"close": [175, 175], // Scale for Camera 4
"superclose": [200, 200] // Scale for Camera 5
};
// Get the current composition
var comp = thisComp;
// Initialize the final scale value (default to [100, 100])
var finalScale = [100, 100];
// Loop through all layers in the composition to check their names
for (var i = 1; i <= comp.numLayers; i++) {
var layer = comp.layer(i);
// Skip the background color layer itself
if (layer == thisLayer) continue;
// If the layer's name matches one of the camera names, update the scale value
if (scaleValues[layer.name]) {
finalScale = scaleValues[layer.name];
}
}
// Return the final scale value to be applied to the background color layer
finalScale;
any clue how I could get this to work and save alot of time, as this would be just one out of several videos I need to use this on! thanks in advance for your help!
