Making a script that dynamically checks if property value have changed
I was trying to automate the location of the layers in a Pre-comp, so each layer in the composition will be moved to begin when a property of the layer (like rotation) reaches a certain value.
From some research, I learned that there isn't a feature to let me listen for events every time a property changes. I wonder if anyone has done something like this and has a solution that I can use as a starting point.
I'm new to the AE scripting, and so far my script can only move the layer at the wrong time, only when the code is executed.
var comp = app.project.activeItem;
var preComp = comp.layer("Pre-comp name");
var currentTime = comp.time;
if (preComp != null && preComp.source != null) {
var layers = preComp.source.layers;
var arrayLength = layers.length;
for (var i = 1; i <= arrayLength; i++) {
var workingLayer = layers[i];
if (workingLayer.transform.rotationY <= 90) {
workingLayer.startTime = currentTime;
}
}
}
The layer's rotation is adjusted by a parent object that is controlled by a Null. So when the parent reaches the angle needed, the child that inherits the rotation should be moved to the current time starting point.
