I got it somehow running. the trick was to check if the animation has started or not and use different calculations for the yPos,  See the Pen XWQbdOv?editors=0011 by destroy90210 (@destroy90210) on CodePen   Not sure if this is best practise but it works