Page 1 of 1
How to clear all keys of a property
Posted: December 4th, 2022, 8:12 am
by SolidBlock
I know I can clear all keys of a property through the following code:
Code: Select all
for (var index = property.numKeys; index >=1; index--) {
property.removeKey(index);
}
However, when I actually practise it, it consumes quite a long time, if the property has many keys. I don't know why it is so time-consuming. If I manually click the clock button in the AE instead of using the code, it can be quickly done.
So is there any method to quickly clear all markers of a property?
Re: How to clear all keys of a property
Posted: July 19th, 2023, 7:05 am
by Nishant
A faster way to do this would be to select the keyframes you want to delete and execute the in-app "Delete" command
something like this:
Code: Select all
app.executeCommand(2004); //use this to make sure nothing is selected, in-app deselect all command
property.selected = true; //select the property, this also selects all the keyframes of that property
app.executeCommand(21); //in-app clear command
This is way faster than deleting the keyframes using a loop.
great list of other in-app comands here: https://hyperbrew.co/blog/after-effects-command-ids/
Re: How to clear all keys of a property
Posted: August 17th, 2024, 8:25 am
by evefalcao
The executeCommand function is significantly faster for this task: