Mask Reverse Path Direction

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
User avatar
monter
Posts: 21
Joined: July 15th, 2004, 1:03 am
Location: Russia, Moskow
Contact:

June 14th, 2005, 6:12 am

Mask Reverse Path Direction? How to make?
davestewart
Posts: 114
Joined: March 10th, 2005, 5:50 am
Location: London, UK
Contact:

June 14th, 2005, 1:26 pm

Perhaps if you could be more specific....
User avatar
monter
Posts: 21
Joined: July 15th, 2004, 1:03 am
Location: Russia, Moskow
Contact:

June 15th, 2005, 1:48 am

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.
davestewart
Posts: 114
Joined: March 10th, 2005, 5:50 am
Location: London, UK
Contact:

June 15th, 2005, 6:44 am

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
davestewart
Posts: 114
Joined: March 10th, 2005, 5:50 am
Location: London, UK
Contact:

June 15th, 2005, 8:23 am

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
User avatar
monter
Posts: 21
Joined: July 15th, 2004, 1:03 am
Location: Russia, Moskow
Contact:

June 16th, 2005, 12:42 am

Thanks! Works!
Only changes "Set First Vertex".
morphing no testing.
davestewart
Posts: 114
Joined: March 10th, 2005, 5:50 am
Location: London, UK
Contact:

June 18th, 2005, 6:50 am

dude...
You'll have to be a little more descriptive with your responses! I'm a scripter - not a cryptologist!
philspitler
Posts: 39
Joined: November 2nd, 2005, 10:20 am
Contact:

March 9th, 2007, 11:20 am

I can't get this script to work in AE7, I get Syntax error on line2.

Any ideas?

Thanks.

Phil
Phil Spitler
User avatar
monter
Posts: 21
Joined: July 15th, 2004, 1:03 am
Location: Russia, Moskow
Contact:

March 12th, 2007, 1:57 am

Post Reply