Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Reverse X and Y coordinates for puppet pin motion

  • Reverse X and Y coordinates for puppet pin motion

    Posted by Tony Caver on August 3, 2012 at 10:36 pm

    Hey folks, I’m linking puppet pins to a track with motion tracking applied. The source track has mostly up and down motion, and I would like to use that vertical motion to drive a puppet pin horizontally. I’ve been searching for an expression to switch x and y…. with no luck. Optimally, a null would be linked to the source tracking data, and pins would be adjustable through the null anchor point, and X and Y would be reversed.

    Both of these expressions work by themselves but I can’t hack them together. First one attaches source motion data–Second one reverses my x and y.

    L = thisComp.layer("source");
    M = L.motionTracker("Tracker 1")("Track Point 1");
    fromWorld(L.toWorld(M.attachPoint*-1
    ) + M.attachPointOffset)

    L = thisComp.layer("Null_1");
    x = (L.position-L.position.valueAtTime(L.inPoint))[1];
    value + [x,0]

    Dan Ebberts replied 14 years, 1 month ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    August 3, 2012 at 11:29 pm

    I haven’t tested it, but it seems like this should work:

    L = thisComp.layer(“source”);
    M = L.motionTracker(“Tracker 1”)(“Track Point 1”);
    P = fromWorld(L.toWorld(M.attachPoint*-1 ) + M.attachPointOffset)
    L2 = thisComp.layer(“Null_1”);
    x = (L2.position-L2.position.valueAtTime(L2.inPoint))[1];
    P + [x,0]

    Dan

  • Tony Caver

    August 4, 2012 at 1:34 am

    I tried your code on my null but the puppet pin still had Y and X movement. My source (which also has the pins and motion data) has
    this:l = thisComp.layer(“Null_1”); fromWorld(l.toWorld(l.anchorPoint));

    My null has this:
    L = thisComp.layer(“Tracker-and-Pins”);
    M = L.motionTracker(“Tracker 1”)(“Track Point 1”);
    P = fromWorld(L.toWorld(M.attachPoint*-1 ) + M.attachPointOffset)
    L2 = thisComp.layer(“Null_1”);
    x = (L2.position-L2.position.valueAtTime(L2.inPoint))[1];
    P + [x,0]

    Is there a way to do this?
    Actual_X=[0] //X data variable
    Actual_Y=[1] //Y data variable

    Position=[Actual_Y, 0] //put the y data into the x dimension.

  • Dan Ebberts

    August 4, 2012 at 5:10 am

    I’m confident that the answer to your question is “yes”, but I don’t have a good picture of what you’re trying to do.

    Dan

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