FORUMS: list search recent posts

Fit to Comp Width

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Borko Grujic
Fit to Comp Width
on Mar 5, 2013 at 10:10:14 am

Hi,

How do I call "Fit to Comp Width" on a layer from a script

I got all other stuff taken care of, I need a function name, I could not find any references for this.

Thanks,
B


Return to posts index

Dan Ebberts
Re: Fit to Comp Width
on Mar 5, 2013 at 7:16:38 pm

Assuming your layer is selected and your comp has focus, this should work:

app.executeCommand(app.findMenuCommandId("Fit to Comp Width"));

Or, you could do it this way:

var myComp = app.project.activeItem;
var myLayer = myComp.layer(1);
var s = (myComp.width*myComp.pixelAspect)/(myLayer.width*myLayer.source.pixelAspect)*100;
myLayer.property("Scale").setValue([s,s]);


Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]