Page 1 of 1

Create an Animated Mask For a Layer

Posted: May 26th, 2008, 5:05 am
by Atomic
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

Re: Create an Animated Mask For a Layer

Posted: May 27th, 2008, 10:15 am
by Atomic
Once again, motionscript has the answer.

http://www.motionscript.com/ae-scriptin ... ted-1.html

Re: Create an Animated Mask For a Layer

Posted: May 27th, 2008, 10:52 am
by Atomic
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!

Re: Create an Animated Mask For a Layer

Posted: May 28th, 2008, 5:55 am
by Atomic
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.