Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Position to Anchor point

  • Position to Anchor point

    Posted by Ramrod16 on May 27, 2007 at 5:26 pm

    I was trying to find a way to link the position of a layer to the anchor point of another layer and figured before I try and look all over in the tutorials I would just post it here.

    Thanks guys

    Ramrod16 replied 18 years, 11 months ago 4 Members · 9 Replies
  • 9 Replies
  • Dan Ebberts

    May 27, 2007 at 5:45 pm

    Hard to guess what you’re trying to do, but try this:

    L = thisComp.layer(“your other layer”);
    L.toWorld(L.anchorPoint);

    Dan

  • Ramrod16

    May 27, 2007 at 5:54 pm

    I will go and try that here in a second. What I am trying to do is link the Anchorpoint of one layer and link it to the position of a differen’t layer. The problem lies in that the value of x and y for one layer are not the same as the values for x and y for the other layer. So I need to make an expression to make them equivalent to eachother. so when one moves four pixels on the x dimension, it will move the other 4 pixels. If that makes any sense.

    Thanks for such a fast response!

  • Ramrod16

    May 27, 2007 at 6:08 pm

    I tried your expression and kept getting errors saying that L.toWorld was undefined. I also made a mistake before, it is Anchorpoint to Position and not Position to Anchorpoint, if that makes any difference.

  • Mike Clasby

    May 27, 2007 at 6:24 pm

    Can you just parent one to the other, sounds like that’s the result you want.

    You can still use expressions on Children, Dan’s territory though.

  • Ramrod16

    May 27, 2007 at 7:07 pm

    When I do that it makes the coardinates the same number, so that won’t work.

    Ex,
    Layer X
    Anchor point 654,156

    Layer Y
    Position 789,123

    When I parent one to the other they each become the same value. I need an expression that will move each the same amount, but at different coardinates.

    Ex,
    Moving each 4 pixels in X and 3 pixels in Y.

    Layer X
    Anchor point 658,159

    Layer Y
    Position 793,126

    What I am using this for is a motion track. The camera is moving as is the subject. I need to track the camera movement separately from the movement of the subject. I am applying both tracking data to a solid layer with particular. The subject’s tracking data will be applied to the anchor point of particular, and the solid layer’s position will be parented to the position of the camera tracking data. I apologize for not being very discriptive from the start, but thanks for such fast responses.

    Chris

  • Filip Vandueren

    May 27, 2007 at 7:43 pm

    Hi Chris,

    you don’t need expressions for that.

    reveal the column ‘parent’ in the timeline bytctrl-clicking/rightclicking above the layer modes.
    Now parent – using the pick-whip – this layer to your other layer.

    You can create expressions by using a similar pick-whip widget, and yes if you would drag it to the position of your first layer, it would copy the values. That’s the confusion perhaps.

    Parenting an entire layer is more like glueing two layers together: the child will follow it’s parent through position, scale, rotations etc. but that has nothing to do with expressions.

  • Ramrod16

    May 27, 2007 at 8:11 pm

    What I am trying to do is emit flames from underneath one of my friends bike tires while he is doing a wallride. Where the tire touches the ground and the wall, flame will be left like a trail. And when he is in the air, there won’t be flame.(we are making a bike video and this is his intro, fallowed with a sound clip from back to the future). So with that said, I need the flames to track with the camera but emit from the bike tire. I tracked the entire camera movement which is about 7000 pixels long and created a solid that big. I need the solid’s position to move along with this data. Then for the plugin, the fire is being emitted from the anchor point. So I need to get an expression to link the anchor point data with the tracker data which is position. If I parent the entire layer, one set of tracking data will be ignored. I can eliminate the problem altogether by having a light being the emmitter, and not having the anchor point be the emmiter, but I would like to see if I can get this to work with expressions. I really need just an algorithm to say if you move this X data 4 pixels, move a different set of X data 4 pixels as well. The same would have to go with the Y coardinates.

    Chris

  • Dan Ebberts

    May 27, 2007 at 11:22 pm

    I think you might just need some variation of this:

    layerX = thisComp.layer(“Layer X”);
    delta = layerX.transform.position – layerX.transform.position.valueAtTime(0);
    value + delta

    Dan

  • Ramrod16

    May 28, 2007 at 9:31 pm

    Thanks Dan, that expression worked perfectly. Thanks a lot for your help.

    Chris

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