Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Creating a stretchy chain of objects

  • Creating a stretchy chain of objects

    Posted by William Anugerah on February 3, 2017 at 3:04 pm

    Hello,

    I’d like to ask for some help, for a rigging purpose I need to have a string of about 4 objects where the middle two (pictured red null) will be constrained between the two end objects (pictured yellow null) in a straight line. It needs to stretch and retain the ratio of distance between the objects and work on all axis.

    I will really appreciate it if anyone can enlighten me on how to make this work and the expressions necessary to do so.

    Emre Anil replied 9 years, 3 months ago 2 Members · 3 Replies
  • 3 Replies
  • Emre Anil

    February 3, 2017 at 3:24 pm

    Assuming t1 and t2 are the Yellow Null Objects:

    First Red Null Object’s position expression:
    n1 = thisComp.layer("t1").transform.position;
    n2 = thisComp.layer("t2").transform.position;
    pX = n1[0] - ((n1[0] - n2[0]) / 3 * 2);
    pY = n1[1] - ((n1[1] - n2[1]) / 3 * 2);
    [pX, pY]

    Second Red Null Object’s position expression:

    n1 = thisComp.layer("t1").transform.position;
    n2 = thisComp.layer("t2").transform.position;
    pX = n1[0] - ((n1[0] - n2[0]) / 3);
    pY = n1[1] - ((n1[1] - n2[1]) / 3);
    [pX, pY]

  • William Anugerah

    February 3, 2017 at 8:13 pm

    Thank you very much! While it does exactly what I wanted, it does reposition the middle (red null) objects into equal distances, which is not quite ideal because my objects are initially laid out in a different ratio.

    I was able to easily offset the resulting position by adding value to the last line ( [xx+pX, yy+pY] ) until they match their initial position, but is there any other way to work this out while keeping the objects’s initial position intact?

  • Emre Anil

    February 4, 2017 at 8:49 am

    I divided the position difference by 3 for the even spacing. changing it according to your ratio should work.

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