Forum Replies Created

Page 1 of 3
  • Hey Ricardo, how are you controlling the hair at the moment? is it on puppet pins? or jsut a layer on its own?

  • Was glad to help, Guys.

    anyways, just for the sake of people that end up on this thread in the future, i’ve collated the most revised versions below, so that people can use the right ones without having to re-read the whole thread.

    (these are 2 different expressions, use the one that suits your needs)

    //inertial children bounce (apply on "position")
    n = 0;
    amp = .04;
    freq = 2.0;
    decay = 3.0;

    ppos=thisLayer.parent.transform.position;
    if (ppos.numKeys > 0){
    n = ppos.nearestKey(time).index;
    if (ppos.key(n).time > time){
    n--;
    }
    }
    if (n == 0){
    ppos.velocity
    t = 100;
    }else{
    t = time - ppos.key(n).time;
    }

    if (n > 0){
    v = ppos.velocityAtTime(ppos.key(n).time - thisComp.frameDuration/10);

    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value
    }

    //inertial children rotation (apply on "rotation", for dagling things like earrings, dreadlocks, pendants etc)
    n = 0;
    amp = .04;
    freq = 2.0;
    decay = 3.0;

    ppos=thisLayer.parent.transform.position;
    parv=clamp(ppos.velocity[0]*amp,-90,90)
    if (ppos.numKeys > 0){
    n = ppos.nearestKey(time).index;
    if (ppos.key(n).time > time){
    n--;
    }
    }
    if (n == 0){
    ppos.velocity[0]
    t = 100;
    }else{
    t = time - ppos.key(n).time;
    }

    if (n > 0){
    v = ppos.velocityAtTime(ppos.key(n).time - thisComp.frameDuration/10)*-1;

    parv + v[0]*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    parv
    }

  • sorry, i forgot aobut the -1

    here is the correct version:

    //inertial children bounce
    n = 0;
    amp = .04;
    freq = 2.0;
    decay = 3.0;

    ppos=thisLayer.parent.transform.position;
    if (ppos.numKeys > 0){
    n = ppos.nearestKey(time).index;
    if (ppos.key(n).time > time){
    n--;
    }
    }
    if (n == 0){
    ppos.velocity
    t = 100;
    }else{
    t = time - ppos.key(n).time;
    }

    if (n > 0){
    v = ppos.velocityAtTime(ppos.key(n).time - thisComp.frameDuration/10);

    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value
    }

  • try this:

    //inertial children bounce
    n = 0;
    amp = .04;
    freq = 2.0;
    decay = 3.0;

    ppos=thisLayer.parent.transform.position;
    if (ppos.numKeys > 0){
    n = ppos.nearestKey(time).index;
    if (ppos.key(n).time > time){
    n--;
    }
    }
    if (n == 0){
    ppos.velocity
    t = 100;
    }else{
    t = time - ppos.key(n).time;
    }

    if (n > 0){
    v = ppos.velocityAtTime(ppos.key(n).time - thisComp.frameDuration/10)*-1;

    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value
    }

  • well spotted. i think this *-1 was still left over from the other expression, and unnecessary for yours. more so, you dont even need to multiply it by 1, as this does absolutely nothing =DDD

    below you’ll find those lines revised.

    if (n > 0){
    v = ppos.velocityAtTime(ppos.key(n).time - thisComp.frameDuration/10);

    value + v[0]*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value
    }

  • this last expression that posted should do it! just drop it on the “position”

  • if all you want is postional oveshoot ( like the original bounce), you can try this:
    i haven’t got AE open at the moment, so if it does not work let me know.

    //inertial children bounce
    n = 0;
    amp = .04;
    freq = 2.0;
    decay = 3.0;

    ppos=thisLayer.parent.transform.position;
    if (ppos.numKeys > 0){
    n = ppos.nearestKey(time).index;
    if (ppos.key(n).time > time){
    n--;
    }
    }
    if (n == 0){
    ppos.velocity[0]
    t = 100;
    }else{
    t = time - ppos.key(n).time;
    }

    if (n > 0){
    v = ppos.velocityAtTime(ppos.key(n).time - thisComp.frameDuration/10)*-1;

    value + v[0]*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value
    }

  • hi Jake,
    the message error that you are getting is because the expression outputs a rotation value (one number ) while the position takes two values (x and y)
    the expression takes velocity and makes into rotation, so it has to go into the “rotation” property, and causes a inertial rotation, not a “bounce”
    what kind of movement are you trying to add to the child layers?

  • yeah, you need a time offset, not multiplying the amount. try using the valueAtTime like this:

    value + thisComp.Layer("Audio Amplitude").effect("Both Channels")("Slider").valueAtTime(time - (index-1)/100)

  • yeah man, keep experimenting! that’s how i lost my fear of expressions :).

    an unnecessary idea: you could use the parent’s “y” velocity and use it as a modifier, after the main expression gets calculated, you add/remove a bit of rotation depending on the vertical speed (positive or negative). i have something on my mind already but it would be a cool exercise to fry your brain a little and learn more =)

    if you do actually decide do to it, and have any problems, ill be here to help.

    All the best!

Page 1 of 3

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