Hi there,
I'm trying to get an up-down-bobbing effect that is symmetrical around the starting location.
I've made a code pen: the red square has the type of motion easing that I want and the yellow square has the symmetry that I want. (green square is just there for comparison of starting location)
The reason that the code is a bit funny is because I want the square to be sensitive to user button presses (implemented for the red square), so that when the user presses a button, the motion stops smoothly, then goes down 2x on button presses before coming up again and resuming the bobbing [i've implemented that by having two separate time lines that affect the red square and pausing one when the other one is active; is this good?]. When the red square comes up again, it looks a bit funny - which is why i thought it would be better if the initial bobbing was coded as symmetrical around the starting location, rather than just down and then yoyo back.
https://codepen.io/JacquieS/details/yqZyar/
Many thanks
Jacquie