I need to animate a bouncing ball through a maze, with obstacles and so on.
Everything went ok so far, tweaking Dan Ebberts's expression about bouncing and squashing that I found here, but when it came to have the ball bounce between a floor and a ceiling, i don't know what to do.
There's a "floor" value, which is the y at which the ball bounces up again, but no upper limit. It should be enough finding a way to switch from an absolute cosine like function to some kind of sawtooth, and then back again.
Here's a tutorial that goes over the Sine wave math for AE. It's quite rambling and he makes a lot of mistakes that get corrected later but, nonetheless, it's quite informative. You may get some ideas.