Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Keep Mask in Place when Layer Move/Scales?

  • Keep Mask in Place when Layer Move/Scales?

    Posted by Christopher Bly on December 4, 2018 at 9:40 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)

    Christopher Bly replied 7 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Kalleheikki Kannisto

    December 9, 2018 at 10:31 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

  • Christopher Bly

    December 10, 2018 at 2:08 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.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy