Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions animating swinging hair (basically object on a swinging rope)

  • animating swinging hair (basically object on a swinging rope)

    Posted by Joel Benjamin on December 15, 2010 at 6:11 pm

    I have a a character with a ponytail. I have been key-framing the pony tail swinging animation but considering this is a 45-minute long film it’s going to get REALLY tiring. Not to mention the fact that animating it all by hand is not EASY.

    I’m fairly expression-savvy and have tried a couple of methods of doing this with expressions but haven’t found anything working super well.

    My initial thoughts were —
    Have the pony tail look at a null layer that’s always on the ground (its x-position parented to the character’s center of gravity)

    Obviously then the hair is too static so I need to somehow add some “spring” to the lookAt to give it some motion and decay. A very dynamic pendulum of some kind.

    Anyway, I haven’t had a ton of luck getting it just right.

    Thoughts?
    cheers
    Joel

    Joel Benjamin replied 15 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Chris Wright

    December 17, 2010 at 5:25 pm
  • Joel Benjamin

    December 17, 2010 at 9:46 pm

    Forgive me for being a tad confused by this reply… Are you linking specifically to your particular comment? This seems to be just a kind of spring expression for position, but not really what I’m looking for

    I kinda figured it out and ended up using a variation of Filip Vandueren’s expression for shirts swinging on a moving clothes line which tracked the speed and movement of a parent layer and applied that velocity to rotation, taking into account some dampeners and weight.

    I started with a Controller Null with 3 expression controllers on it – one each for inertia, stiffness and mass.

    Because the head itself was parented to the neck of the character I couldn’t figure out an easy way to track its velocity at time (I could track the POSITION velocity at a specific time, but couldn’t track the anchorpoint’s velocity at a specific time, which was necessary because I needed the Worldspace coordinates instead of local space as the head was parented to the neck). To solve this, I had another Null (“PonytailPosition”) with its position linked via expression to the worldspace coordinates of the back of the head:


    target=thisComp.layer("ponyTail");
    target.toWorld(target.anchorPoint);

    Then I applied the following to the pony tail’s rotation

    inertia = thisComp.layer("CONTROLLER").effect("inertia")("Slider");
    stiffness = thisComp.layer("CONTROLLER").effect("Stiffness")("Slider");
    mass=thisComp.layer("CONTROLLER").effect("mass")("Slider");
    //these are the sliders attached to the Controller null.
    //I had to play around with the actual variables quite a bit to get
    //the best result, ending up with: .85, .05 and 18 respectively

    lagValue = calcValue(0);
    f= thisComp.frameDuration;
    will=0;

    for (t=0; t<=time; t+=f) {
    delta = calcValue(t) - lagValue;
    will = will * inertia + delta*stiffness ;
    lagValue +=will
    }

    lagValue;

    function calcValue(t) {
    return -thisComp.layer("N_PonytailPosition").position.velocityAtTime(t)[0]/mass;

    }

    Again if the parent (the head, in this case) wasn’t not already a child of another layer, I wouldn’t need to link it to another null, I could just pull the position.velocityAtTime right from the head. But because its local position isn’t actually changing, I needed to convert that to world space via another Null. There’s possibly a more efficient way to do this but this worked fine. Thanks once more to Filip Vandueren for the original script

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