- February 19, 2021 at 11:37 am
Hallo, I have to make some MOGRTs. I have a simple (left justified)Text which, when changed should extend the width of the Text Box (to the right) and the MaskLayer revealing the Text. Should be simple but I’ve been provided with a Photoshop File(With the colour of the text Box) with a Mask on it and this Mask has been animated. Can I use sourceRectAtTime with a mask? How would I go about doing this? Any help would be much appreciated.Thanks
- February 19, 2021 at 5:45 pm
It depends a little on what you mean by ‘mask’. If you mean layer mask like the kind you draw on a layer with the mask tool, then I don’t think so… I don’t know how you would use an expression to change the shape/vertices of a layer mask.
If you mean you’re using a layer as a Track Matte (or Set Matte effect) to reveal the text or the shape layer behind the text, then yes, since you can use sourceRectAtTime() to affect the position of the matte layer.
Assuming the reveal is a kind of simple wipe on the x-axis, try this:
Create a comp-sized solid and name it ‘matte’ and parent it to the layer that you want to reveal (it will make the expression a bit easier).
Add a position keyframe for the matte where and when you want the wipe to start, and then add another keyframe when you want it to end (the final position doesn’t matter since the expression will handle that, but maybe drag it halfway across the screen).
Then try this expression for the matte layer’s position:
startX = key(1).value ;
rect = parent.sourceRectAtTime() ;
endX = rect.width +sourceRectAtTime().width / 2 ;
x = ease( time, key(1).time, key(2).time, startX, endX ) ;
[ x, value ]
The matte layer should now animate from the start position (from the 1st keyframe) to the right edge of the parent.
- February 22, 2021 at 1:43 pm
Hallo Kevin, thanks for the reply. Unfortunately in my case the text had also a text box(also Photoshop Layer with a mask) and the reveal was the same Photoshop Layer(with a mask) I ended up recreating everything as a shape layers so I could use sourceRectAtTime expression. So now its all working. Thanks for your expression there I’ll try it out sometime. All the best, cheers, nick
Log in to reply.