FORUMS: list search recent posts

Expression for auto mask & scale

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Andrew Swann
Expression for auto mask & scale
on Mar 19, 2014 at 8:01:57 pm

Hi folks,

I'm looking for a piece of script that will allow me to add a mask that will effectively crop 10 pixels from either side of a piece of DV anamorphic video, and then zoom the image by 3%

(For ref the video is 720x576 DV PAL anamorphic, pixel aspect 1.46)

Can anyone advise me on how I might go about this?

Many thanks
Andrew


Return to posts index

Dan Ebberts
Re: Expression for auto mask & scale
on Mar 19, 2014 at 8:35:00 pm

This should get you started (assume comp is active and target layer is layer 1):

var myLayer = app.project.activeItem.layer(1);
var w = myLayer.width;
var h = myLayer.height;
var newMask = myLayer.Masks.addProperty("ADBE Mask Atom");
newMask.maskMode = MaskMode.ADD;
var myProperty = newMask.property("ADBE Mask Shape");
myShape = myProperty.value;
myShape.vertices = [[10,0],[w-10,0],[w-10,h],[10,h]];
myShape.closed = true;
myProperty.setValue(myShape);
var s = myLayer.property("Scale").value;
myLayer.property("Scale").setValue(s*1.03);


Dan



Return to posts index

Andrew Swann
Re: Expression for auto mask & scale
on Apr 2, 2014 at 10:51:02 am

Hi Dan,

Apologies for the late reply, thanks so much for the line of code, it works an absolute treat.

Kind regards
Andrew


Return to posts index

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