ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Keep Mask in Place when Layer Move/Scales?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Christopher Bly
Keep Mask in Place when Layer Move/Scales?
on Dec 4, 2018 at 9:40:21 pm

I'm currently creating a preset that requires a mask that stays connected to the bottom of the screen. If have managed to make the following expression that manages to keep the mask in place when the layer is moved, but it still moves when scaled. Does anyone have any ideas on how I could fix this issue?

var compWide = thisComp.width;
var compHigh = thisComp.height;
var halfComp = [compWide/2,compHigh/2];
var floorHigh = effect("Controls")("Floor Height")/100;

var worldPos = thisLayer.toWorld(transform.position);
var worldPosOffset = (worldPos - halfComp);

var bl = [0, compHigh ] - worldPosOffset;
var br = [compWide, compHigh] - worldPosOffset;

var tl = [0 , compHigh - (floorHigh * compHigh)] - worldPosOffset;
var tr = [compWide, compHigh - (floorHigh * compHigh)] - worldPosOffset;

createPath(points = [tl ,tr ,br ,bl ], inTangents = [], outTangents = [], is_closed = true)


Return to posts index

Kalleheikki Kannisto
Re: Keep Mask in Place when Layer Move/Scales?
on Dec 9, 2018 at 10:31:36 am

Make your life easier by using a track matte instead of a mask. Works like charm when you need to move the mask independently of the layer.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Christopher Bly
Re: Keep Mask in Place when Layer Move/Scales?
on Dec 10, 2018 at 2:08:06 pm

I do know that a track matte would solve this problem, but unfortunately I am looking to make a preset. I can only save the preset if I can get everything to work on one layer, hence why I am trying to use a mask instead.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]