Detecting keyframe on current time
Hi everyone,
Is there any fast way to detect if property has a keyframe on current time?
Hi everyone,
Is there any fast way to detect if property has a keyframe on current time?
You'd use a combination of the nearestKeyIndex(time) and keyTime(index) property methods.
For example:
var activeItem = app.project.activeItem
if (activeItem != null && activeItem instanceof CompItem) {
var prop = activeItem.selectedProperties[0];
if (prop != null && prop.numKeys > 0) {
alert("current time = " + activeItem.time + " nearest key time = " + prop.keyTime(prop.nearestKeyIndex(activeItem.time)));
if (prop.keyTime(prop.nearestKeyIndex(activeItem.time)) == activeItem.time) {
alert("There's a keyframe at this time");
}
}
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.