bounce an element with gravity
The function takes 5 paramters:
ms
: number in milliseconds, time of one movement, bounce up or bounce down, reduce gradually.counter
: integer, how many times to bounce.dy
: number, pixels to move vertically, cannot be negative.dx
: number, pixels to move horizontally, move right if positive, left if negative.press
: float between0
to1
, the smaller, the ball will be more compressed at ground.