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:

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

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

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:

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:

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:

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

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:

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:

Post Reply