Page 1 of 1

Mask Reverse Path Direction

Posted: June 14th, 2005, 6:12 am
by monter
Mask Reverse Path Direction? How to make?

Posted: June 14th, 2005, 1:26 pm
by davestewart
Perhaps if you could be more specific....

Posted: June 15th, 2005, 1:48 am
by monter
1.Select Layer
2.Select Mask
3.var TempMaskArray= new Array(Select Mask)
// TempMaskArray[0,1,2,3,4...,n]
4...
5. Select Mask = newMaskArray[n,...,4,3,2,1,0]

In the illustrator10 there is a function
Windows->Attributes(F11) Reverse Path Direction OFF / Reverse Path Direction ON
In the After Effects is not present.

Example.
One solid, two elliptical masks.
We apply Effect->Render->Stroke.
Image

Problems appear at morphing masks.

Posted: June 15th, 2005, 6:44 am
by davestewart
I would probably do something like :

- create a new shape object
- loop through the verts of the original mask and assign to the shape
- loop through the in and out tangents, swap them, and add to the shape
- apply the shape

A little function could do this quite neatly I'm sure.
Do you script?

:D

Posted: June 15th, 2005, 8:23 am
by davestewart
I started thinking about it,so thought I'd do the leg work... just for fun....

Code: Select all

function reverseMask (obj,maskIndex){
	// check
		if(obj==undefined){
			alert('Object undefined');return
			}
		 if(maskIndex>obj.Masks.numProperties){
			alert('Incorrect mask index specified');return
		 	}
		
	// existing mask
		var curMask=	obj.Masks.property(maskIndex).property("ADBE Mask Shape")
		var verts=		curMask.value.vertices
		var inTans=	curMask.value.inTangents
		var outTans=	curMask.value.outTangents
		
	// collect the values
		var tempVerts=[]
		var tempInTans=[]
		var tempOutTans=[]
		
		for(var i=curMask.value.vertices.length-1;i>=0;i--){
			tempVerts.push(verts[i])
			tempOutTans.push(inTans[i])
			tempInTans.push(outTans[i])
			}
		
	// build the shape
		var tempMask=new Shape()
		tempMask.vertices = tempVerts
		tempMask.inTangents = tempInTans
		tempMask.outTangents = tempOutTans
		tempMask.closed=curMask.value.closed
		
	// assign mask
		curMask.setValue(tempMask)
	}
	

reverseMask(app.project.activeItem.layers[1],1)
It seems to reverse the mask just fine, although Vegas doesn't seem to respect this? Maybe your morphing thing will.

Let me know...
Cheers,
Dave

Posted: June 16th, 2005, 12:42 am
by monter
Thanks! Works!
Only changes "Set First Vertex".
morphing no testing.

Posted: June 18th, 2005, 6:50 am
by davestewart
dude...
You'll have to be a little more descriptive with your responses! I'm a scripter - not a cryptologist!

Reverse Mask

Posted: March 9th, 2007, 11:20 am
by philspitler
I can't get this script to work in AE7, I get Syntax error on line2.

Any ideas?

Thanks.

Phil

Posted: March 12th, 2007, 1:57 am
by monter