I have a ball that bounces off the walls. This bounce is simple, I just do it (snippet)
if ( x - moveSpeed < 0 )
However, I also have a rectangle that the player is moving. The bounce on it almost works like a rebound on the walls.

But I realized that when the ball received the same movement as the image, it is impossible to make it rise again. Therefore, I need some kind of calculation regarding the movement of the rectangles in order to influence the outgoing corner of the ball. When moving, the rectangle always received a constant speed of movement. This figure shows a rectangle moving to the left, and the ball enters it during its movement, which leads to a 90-degree angle. (Which should not always be 90).

Sorry for my shitty pictures, I hope they make sense. My math is rusty, so I really might need a push in the right direction.
source share