Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Label follow ball bounce *but* remain at the maximum historical position?

  • Label follow ball bounce *but* remain at the maximum historical position?

    Posted by Simon Roberts on February 14, 2014 at 1:21 pm

    I’ve tried and I’m stuck …any help greatly appreciated 🙂

    MORE DETAIL: I want have a label follow a ball bounce and have it remain at the maximum historical height of the ball (which will gradually increase).

    I can make the label follow the ball (easy!) but I can’t make it remain in position once it’s reached it’s maximum height to date. Can anyone show me how to do this?

    This obviously isn’t it but this all I have that works so far:

    this_y = transform.position[1];
    ball_y = thisComp.layer("Ball").transform.yPosition;

    if (ball_y < this_y) {
    new_y = ball_y;
    } else {
    new_y = this_y;
    }

    [transform.position[0], new_y]

    Simon Roberts replied 12 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 14, 2014 at 5:58 pm

    Something like this maybe:


    ballY = thisComp.layer("Ball").transform.yPosition;
    minY = value[1];
    f = timeToFrames(inPoint);
    fStop = timeToFrames(time);

    while(f <= fStop){
    minY = Math.min(minY,ballY.valueAtTime(framesToTime(f)));
    f++;
    }
    [value[0],minY]

    Dan

  • Simon Roberts

    February 14, 2014 at 6:05 pm

    Thanks Dan! Works perfectly.

    Also I’ve read lots of your posts before and some of your online guides too – thanks for being so generous with your time and knowledge.

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