Create an Animated Mask For a Layer

What type of scripts do you need?

Moderator: byronnash

Post Reply
User avatar
Atomic
Posts: 157
Joined: April 30th, 2007, 5:55 am
Location: United States, Ohio

Hi All,

I am trying to automate a process and I need to create an animated mask on every layer I import.

I don't know if this is possible, but is there a way to create a mask using JSX? If so, how do I animate it?

Thanks
"Up And Atom

No...No

Up And At Them!"
User avatar
Atomic
Posts: 157
Joined: April 30th, 2007, 5:55 am
Location: United States, Ohio

Once again, motionscript has the answer.

http://www.motionscript.com/ae-scriptin ... ted-1.html
"Up And Atom

No...No

Up And At Them!"
User avatar
Atomic
Posts: 157
Joined: April 30th, 2007, 5:55 am
Location: United States, Ohio

Hmmm, almost.

Code: Select all

// create square mask
  var newMask = mySolid.Masks.addProperty("Mask");
  newMask.inverted = true;
  var myMaskShape = newMask.property("maskShape");
  var myShape = myMaskShape.value;
  myShape.vertices = [[5,5],[5,45],[45,45],[45,5]];
  myShape.closed = true;
  myMaskShape.setValue(myShape);
Does anyone know what the code syntax is for animating the mask?

Code: Select all

myPosition.setValueAtTime(4,[80,30]);
Here is position, what is the equivalent for mask verticies?

Thanks!
"Up And Atom

No...No

Up And At Them!"
User avatar
Atomic
Posts: 157
Joined: April 30th, 2007, 5:55 am
Location: United States, Ohio

more experimenting has lead to this.

Code: Select all

		myShape.vertices = [[0,0],[w,0],[w,h],[0,h]];
		myShape.closed = true;
		myMaskShape.setValueAtTime(0,myShape);

		offset = 50;
		myShape.vertices = [[0+offset,0],[w+offset,0],[w+offset,h],[0+offset,h]];
		myShape.closed = true;
		myMaskShape.setValueAtTime(1,myShape);
It looks like setValueAtTime is all you need.
"Up And Atom

No...No

Up And At Them!"
Post Reply