Skip to main content
Participating Frequently
July 23, 2023
Answered

How to perform exponential scale in an AE script ?

  • July 23, 2023
  • 3 replies
  • 454 views

I am working on an ae script (jsx format) and would like to apply an exponential scale on a layer (same than in keyframe assistant). What is the command to use ?

Thanks !

This topic has been closed for replies.
Correct answer Dan Ebberts

This seems to work:

var myComp = app.project.activeItem;
var myLayer = myComp.layer(1);
for (var i = 1; i <= myComp.numLayers; i++){
	myComp.layer(i).selected = false;
}
var myProp = myLayer.property("Scale");
myProp.setSelectedAtKey(1,true);
myProp.setSelectedAtKey(2,true);
app.executeCommand(app.findMenuCommandId("Exponential Scale"));

3 replies

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
July 23, 2023

This seems to work:

var myComp = app.project.activeItem;
var myLayer = myComp.layer(1);
for (var i = 1; i <= myComp.numLayers; i++){
	myComp.layer(i).selected = false;
}
var myProp = myLayer.property("Scale");
myProp.setSelectedAtKey(1,true);
myProp.setSelectedAtKey(2,true);
app.executeCommand(app.findMenuCommandId("Exponential Scale"));
Mylenium
Legend
July 23, 2023

Why would you even bother looking up the command? You can just as easily simply implement a Math.pow() or Math.exp() in your own code.

 

Mylenium

Participating Frequently
July 24, 2023

And what formula would you then use for, eg, de-scale from 3.4 to 2.2 ? Thanks

Dan Ebberts
Community Expert
Community Expert
July 23, 2023

Once you set up the appropriate context (with just the scale keyframes selected) you could try:

app.executeCommand(app.findMenuCommandId("Exponential Scale"));