Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Change floor position in Bounce expression

  • Change floor position in Bounce expression

    Posted by David Rodriguez on May 14, 2008 at 10:21 am

    Darby Edelen and Dan Ebberts helped me cobble this expression together and now I need to modify it in the following way.

    I need the ball to bounce ONCE on the floor then I need the floor to fall away. I have tried tying the floor to an expression slider and animating it at the point where I need the change to happen, but this affects the whole animation and just sends the ball hurtling downwards. I just need the floor to act as if it isn’t there on the second bounce.

    Any help is much appreciated.
    With many thanks,
    David

    Vy0 = 200; //initial y velocity (pixels/second)
    seedRandom(index,true);
    Vx0 =random(-200,200); // initial x velocity (pixels/second)
    g = 2500; // gravity (pixels/second/second)
    floor = 1050;
    e = .82; //elasticity

    b = floor – position[1];
    h = b + Vy0*Vy0/(2*g);
    T = Vy0/g + Math.sqrt(2*h/g);

    if (time < T){ y = Vy0*time - g*time*time/2 + b; }else{ Vy = -(Vy0 - g*T); while (true){ Vy *= e; t = T; T += 2*Vy/g; if (time < T){ t = time - t; y = Vy*t - g*t*t/2; break; }else if (T - t < thisComp.frameDuration){ y = 0; break; } } } [position[0] + Vx0*time, floor - y]

    David Rodriguez replied 18 years ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    May 14, 2008 at 1:19 pm

    Try this:

    Vy0 = 200; //initial y velocity (pixels/second)
    seedRandom(index,true);
    Vx0 =random(-200,200); // initial x velocity (pixels/second)
    g = 2500; // gravity (pixels/second/second)
    floor = 1050;
    e = .82; //elasticity

    b = floor – position[1];
    h = b + Vy0*Vy0/(2*g);
    T = Vy0/g + Math.sqrt(2*h/g);

    if (time < T){ y = Vy0*time - g*time*time/2 + b; }else{ Vy = -(Vy0 - g*T); Vy *= e; t = time - T; y = Vy*t - g*t*t/2; } [position[0] + Vx0*time, floor - y] Dan

  • David Rodriguez

    May 14, 2008 at 7:27 pm

    This looks great, thank you.
    Now of course I need the balls to bounce twice not just once before the floor falls away.

    Help please!

    Con Muchas Gracias!
    David

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