• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

How to remove keyframes of all properties

Explorer ,
Nov 22, 2023 Nov 22, 2023

Copy link to clipboard

Copied

I wrote a script but it only works with Anchor Point, Position, Rotation,...
How to delete all keyframes of all properties of a layer?
Can someone give me an example, thank you very much

    var activeComp = app.project.activeItem;
        var selectedLayer = activeComp.selectedLayers[0];
            for (var i = selectedLayer.property("Transform").numProperties; i >= 1; i--) {
                var prop = selectedLayer.property("Transform").property(i);
                for (var j = prop.numKeys; j > 0; j--) {
                    prop.removeKey(j);
                }
            }

Untitled.png

TOPICS
Scripting

Views

150

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 22, 2023 Nov 22, 2023

You need a recursive property sniffer. Try this:

function processProperty(theProp){
	if (theProp.propertyType == PropertyType.PROPERTY){
		for (var j = theProp.numKeys; j > 0; j--){
			theProp.removeKey(j);
		}
	}else{ // must be a group
		for (var i = 1; i <= theProp.numProperties; i++){
			processProperty(theProp.property(i));
		}
	}
}
var myLayer = app.project.activeItem.selectedLayers[0];
processProperty(myLayer);

Votes

Translate

Translate
Community Expert ,
Nov 22, 2023 Nov 22, 2023

Copy link to clipboard

Copied

You need a recursive property sniffer. Try this:

function processProperty(theProp){
	if (theProp.propertyType == PropertyType.PROPERTY){
		for (var j = theProp.numKeys; j > 0; j--){
			theProp.removeKey(j);
		}
	}else{ // must be a group
		for (var i = 1; i <= theProp.numProperties; i++){
			processProperty(theProp.property(i));
		}
	}
}
var myLayer = app.project.activeItem.selectedLayers[0];
processProperty(myLayer);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 23, 2023 Nov 23, 2023

Copy link to clipboard

Copied

LATEST

thank you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines