Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Link Pin to the Bounding box of a shape layer

  • Link Pin to the Bounding box of a shape layer

    Posted by James Ronan on June 7, 2017 at 11:12 am

    Hey guys

    I’ve been using CC Bend It on a shape layer, but anytime I try to change position or rotate the shape layer the pin remains still in relation to the comp and I’ve had to manually keyframe the Start and End points with the layer.

    I’m trying to get the Start pin to always been center top of the shape (bounding box), and the End pin to always be center bottom.

    I’ve tried a few different variations but so far no avail. This is what I’ve got so far… but it’s not even remotely working aha:

    //For Start Pin at the center top of the bounding box
    var L = thisLayer.sourceRectAtTime(0,true);
    var xPos = L.left + thisLayer.width/2;
    var yPos = L.top;
    [xPos,yPos]

    //For Start Pin at the center bottom of the bounding box
    var L = thisLayer.sourceRectAtTime(0,true);
    var xPos = L.left + thisLayer.width/2;
    var yPos = L.top + thisLayer.height;
    [xPos,yPos]

    Any direction would be massively appreciated

    J

    James Ronan replied 8 years, 11 months ago 1 Member · 1 Reply
  • 1 Reply
  • James Ronan

    June 7, 2017 at 4:12 pm

    After trawling through the forums I’ve modified an expression that Dan Ebberts wrote a few years ago and it is ALMOST working!!

    It now works on position and scale… just not for rotation.

    This is my version of the expression:

    //For Start Pin at the center top of the bounding box
    L = thisLayer;
    rect = L.sourceRectAtTime(time,false);
    x = L.toComp([rect.left+rect.width/2,rect.top])[0];
    y = L.toComp([rect.top+rect.width/2,rect.top])[1];

    [x,y]

    //For End Pin at the center top of the bounding box
    L = thisLayer;
    rect = L.sourceRectAtTime(time,false);
    x = L.toComp([rect.left+rect.width/2,rect.top+rect.height])[0];
    y = L.toComp([rect.top+rect.width/2,rect.top+rect.height])[1];

    [x,y]

    Any suggestions welcome 🙂

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