You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 7-animation/3-js-animation/1-animate-ball/solution.md
+4-6Lines changed: 4 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,10 @@
1
-
To bounce we can use CSS property `top`and `position:absolute`for the ball inside the field with`position:relative`.
1
+
Чтобы заставить мячик прыгать, можно использовать CSS-свойство `top`и задать мячику `position:absolute`внутри поля с`position:relative`.
2
2
3
-
The bottom coordinate of the field is `field.clientHeight`. But the `top`property gives coordinates for the top of the ball, the edge position is`field.clientHeight - ball.clientHeight`.
3
+
Нижняя координата поля -- `field.clientHeight`. CSS-свойство `top`относится к верхней границе мяча, которая должна идти от 0 до`field.clientHeight - ball.clientHeight`.
4
4
5
-
So we animate the `top` from `0` to `field.clientHeight - ball.clientHeight`.
5
+
А чтобы получить эффект "скачущего" мяча, мы можем использовать функцию расчета времени `bounce` в режиме `easeOut`.
6
6
7
-
Now to get the "bouncing" effect we can use the timing function `bounce` in `easeOut` mode.
0 commit comments