Creating Masks with Responsive Vertices

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
VinhSonNguyen
Posts: 2
Joined: July 17th, 2012, 11:20 pm

Hello everyone,

I was wondering if it was possible to create mask vertices without actually defining the exact coordinates.

For an example, let's say I wanted to create vertice point exactly 10% from the top and bottom of a layer. I could easily define coordinates like the following:

Code: Select all

definedMaskShape.vertices = [[0,100],[0,620],[1280,620],[1280,100]];
But when changing the size of the layer, obviously 10% from the top/bottom results in different coordinates. Is it possible to create vertices using percentages or something instead of exact coordinate points?

Thanks for your time and help. :)
Alan Eddie
Posts: 30
Joined: January 12th, 2012, 1:36 am
Location: Ireland
Contact:

Something like this: as a 2 element array: ?
[app.project.activeItem.width/10, app.project.activeItem.height/10, ]
Alan Eddie
_______________________
www.alaneddie.com
3d Animation and VFX
RTE
Dublin
VinhSonNguyen
Posts: 2
Joined: July 17th, 2012, 11:20 pm

Alan Eddie wrote:Something like this: as a 2 element array: ?
[app.project.activeItem.width/10, app.project.activeItem.height/10, ]
Hey Alan,

Excuse my inexperience knowledge, but how would I apply that to mask vertices? I know for sure that would work when creating or modifying a layer, but how would I translate that to drawing mask points?

Thanks for your help!
Alan Eddie
Posts: 30
Joined: January 12th, 2012, 1:36 am
Location: Ireland
Contact:

Code: Select all

var newMask = mySolid.Masks.addProperty("Mask");
				  var myMaskShape = newMask.property("maskShape");
				  var myShape = myMaskShape.value;
				  myShape.vertices = [a,b,c,d];
				  myShape.closed = true;
				  myMaskShape.setValue(myShape);
a,b,c,d are 2 element arrays. So it's just mathematics getting the values.. from the comp or the layer or performing a calculation between the two. The zero coordinates start top left and work counter intuitively to some other software.
Alan Eddie
_______________________
www.alaneddie.com
3d Animation and VFX
RTE
Dublin
Post Reply