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
+1-1
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@ To bounce we can use CSS property `top` and `position:absolute` for the ball ins
2
2
3
3
The bottom coordinate of the field is `field.clientHeight`. The CSS `top` property refers to the upper edge of the ball. So it should go from `0` till `field.clientHeight - ball.clientHeight`, that's the final lowest position of the upper edge of the ball.
4
4
5
-
To to get the "bouncing" effect we can use the timing function `bounce` in `easeOut` mode.
5
+
To get the "bouncing" effect we can use the timing function `bounce` in `easeOut` mode.
Copy file name to clipboardExpand all lines: 7-animation/3-js-animation/article.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ setInterval(animate3, 20);
77
77
78
78
These several independent redraws should be grouped together, to make the redraw easier for the browser and hence load less CPU load and look smoother.
79
79
80
-
There's one more thing to keep in mind. Sometimes when CPU is overloaded, or there are other reasons to redraw less often (like when the browser tab is hidden), so we really shouldn't run it every `20ms`.
80
+
There's one more thing to keep in mind. Sometimes CPU is overloaded, or there are other reasons to redraw less often (like when the browser tab is hidden), so we really shouldn't run it every `20ms`.
81
81
82
82
But how do we know about that in JavaScript? There's a specification [Animation timing](http://www.w3.org/TR/animation-timing/) that provides the function `requestAnimationFrame`. It addresses all these issues and even more.
83
83
@@ -227,7 +227,7 @@ See in action (click to activate):
227
227
228
228
[iframe height=40 src="quad" link]
229
229
230
-
...Or the cubic curve or event greater `n`. Increasing the power makes it speed up faster.
230
+
...Or the cubic curve or even greater `n`. Increasing the power makes it speed up faster.
231
231
232
232
Here's the graph for `progress` in the power `5`:
233
233
@@ -397,15 +397,15 @@ The effect is clearly seen if we compare the graphs of `easeIn`, `easeOut` and `
397
397
398
398

399
399
400
-
- <spanstyle="color:#EE6B47">Red</span> is the regular variantof`circ` (`easeIn`).
400
+
- <spanstyle="color:#EE6B47">Red</span> is the regular variant of`circ` (`easeIn`).
As we can see, the graph of the first half of the animation is the scaled down `easeIn`, and the second half is the scaled down `easeOut`. As a result, the animation starts and finishes with the same effect.
405
405
406
406
## More interesting "draw"
407
407
408
-
Instead of moving the element we can do something else. All we need is to write the write the proper `draw`.
408
+
Instead of moving the element we can do something else. All we need is to write the proper `draw`.
0 commit comments