Skip to main content
sergeim82261357
Known Participant
June 9, 2019
Answered

How to adjust speed of basketball?

  • June 9, 2019
  • 2 replies
  • 532 views

Hello,

I'm trying to adjust speed of basketball in graph editor with no success. Can you please have a look to advise. It starts 0:10. I'm not sure I'm just providing a screenshot just in case as well. Thanks in advance,

Basketball Shot - YouTube

    This topic has been closed for replies.
    Correct answer Rick Gerard

    If you want to try and manipulate position and speed in the graph editor you want the graph to look something like this:

    It's almost impossible to do by hand.

    If this was my project I would start with about 6 layers. The bottom would be a clean plate, then the shot of the kid throwing the ball but masked so that the ball disappeared as soon as it hit the first can, then the ball replacement layer with an expression to make it bounce straight up and down, then a null to move the ball layer toward the net using parenting, then another masked shot with the ball going through the net to match cut to the action.

    If you head over to Dan Ebberts website and look for realistic bounce you'll find this expression (which I slightly modified)

    elev = degreesToRadians(90);// to make it bounce straight up and down

    v = 1900;

    e = .9; // closer to a basket ball's elasticity

    f = .85; // closer to the friction I would expect

    g = 5000;

    nMax = 4; // maximum number of bounces

    tLaunch = 1; // time in seconds when the ball launches

    vy = v*Math.sin(elev);

    vx = v*Math.cos(elev);

    if (time >= tLaunch){

      t = time - tLaunch;

      tCur = 0;

      segDur = 2*vy/g;

      tNext = segDur;

      d = 0; // x distance traveled

      nb = 0; // number of bounces

      while (tNext < t && nb <= nMax){

      d += vx*segDur;

      vy *= e;

      vx *= f;

      segDur *= e;

      tCur = tNext;

      tNext += segDur;

      nb++

      }

      if(nb <= nMax){

      delta = t - tCur;

      x = d + delta*vx;

      y = delta*(vy - g*delta/2);

      }else{

      x = d;

      y = 0;

      }

      value + [x,-y]

    }else

      value

    The basic comp would look like this:

    Because the tops of the cans are not level the easiest way to get the ball to bounce exactly on top of each one is to animate the position of a null, then just adjust the timing. It took me less than 5 minutes to set this up. If I tried to manually adjust the graph editor like you are doing I could easily fiddle with the timing and the curves for a couple of hours.

    2 replies

    Roland Kahlenberg
    Legend
    June 10, 2019

    I'll add to what Rick has shared and my take is to use the Separate Dimension feature which separates the X and Y axes. This allows for a more granular control over your X and Y properties. Take a look at this tutorial -

    Using Separate Dimensions in After Effects to Create a Bouncing Ball - YouTube

    Very Advanced After Effects Training | Adaptive &amp; Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV
    sergeim82261357
    Known Participant
    June 10, 2019

    Thank you Roland. I actually used separate dimension but somewhere screwed it. I will try again but probably need to learn expressions. Life would be easier with them.

    Rick GerardCommunity ExpertCorrect answer
    Community Expert
    June 10, 2019

    If you want to try and manipulate position and speed in the graph editor you want the graph to look something like this:

    It's almost impossible to do by hand.

    If this was my project I would start with about 6 layers. The bottom would be a clean plate, then the shot of the kid throwing the ball but masked so that the ball disappeared as soon as it hit the first can, then the ball replacement layer with an expression to make it bounce straight up and down, then a null to move the ball layer toward the net using parenting, then another masked shot with the ball going through the net to match cut to the action.

    If you head over to Dan Ebberts website and look for realistic bounce you'll find this expression (which I slightly modified)

    elev = degreesToRadians(90);// to make it bounce straight up and down

    v = 1900;

    e = .9; // closer to a basket ball's elasticity

    f = .85; // closer to the friction I would expect

    g = 5000;

    nMax = 4; // maximum number of bounces

    tLaunch = 1; // time in seconds when the ball launches

    vy = v*Math.sin(elev);

    vx = v*Math.cos(elev);

    if (time >= tLaunch){

      t = time - tLaunch;

      tCur = 0;

      segDur = 2*vy/g;

      tNext = segDur;

      d = 0; // x distance traveled

      nb = 0; // number of bounces

      while (tNext < t && nb <= nMax){

      d += vx*segDur;

      vy *= e;

      vx *= f;

      segDur *= e;

      tCur = tNext;

      tNext += segDur;

      nb++

      }

      if(nb <= nMax){

      delta = t - tCur;

      x = d + delta*vx;

      y = delta*(vy - g*delta/2);

      }else{

      x = d;

      y = 0;

      }

      value + [x,-y]

    }else

      value

    The basic comp would look like this:

    Because the tops of the cans are not level the easiest way to get the ball to bounce exactly on top of each one is to animate the position of a null, then just adjust the timing. It took me less than 5 minutes to set this up. If I tried to manually adjust the graph editor like you are doing I could easily fiddle with the timing and the curves for a couple of hours.