Skip to content

Commit 09ab77a

Browse files
authored
Merge pull request #287 from longo-andrea/article/js-animations
JavaScript animations
2 parents cdfdc60 + fc6635f commit 09ab77a

File tree

7 files changed

+145
-145
lines changed

7 files changed

+145
-145
lines changed

Diff for: 7-animation/3-js-animation/1-animate-ball/solution.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
To bounce we can use CSS property `top` and `position:absolute` for the ball inside the field with `position:relative`.
1+
Per il rimbalzo potete utilizzare la proprietà CSS `top` e `position:absolute` sulla palla dentro il campo con `position:relative`.
22

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.
3+
Le coordinate del fondo del campo sono `field.clientHeight`. La proprietà CSS `top` fa riferimento al bordo alto della palla. Quindi dovrebbe andare da `0` fino a `field.clientHeight - ball.clientHeight`, questa è la posizione finale, quella più bassa rispetto al bordo alto della palla.
44

5-
To get the "bouncing" effect we can use the timing function `bounce` in `easeOut` mode.
5+
Per dare l'effetto di "rimbalzo" possiamo utilizzare la funzione di temporizzazione `bounce` in modalità `easeOut`.
66

77
Here's the final code for the animation:
88

Diff for: 7-animation/3-js-animation/1-animate-ball/task.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ importance: 5
22

33
---
44

5-
# Animate the bouncing ball
5+
# Fate rimbalzare la palla
66

7-
Make a bouncing ball. Click to see how it should look:
7+
Fate rimbalzare la palla. Clicca per vedere come dovrebbe apparire l'animazione:
88

99
[iframe height=250 src="solution"]

Diff for: 7-animation/3-js-animation/2-animate-ball-hops/solution.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
In the task <info:task/animate-ball> we had only one property to animate. Now we need one more: `elem.style.left`.
1+
Nell'esercizio <info:task/animate-ball> era richiesto di animare una sola proprietà. Ora dovete animarne una in più: `elem.style.left`.
22

3-
The horizontal coordinate changes by another law: it does not "bounce", but gradually increases shifting the ball to the right.
3+
La coordinata orizzontale varia secondo un'altra regola: non deve limitarsi a rimbalzare, ma deve anche scorrere verso destra.
44

5-
We can write one more `animate` for it.
5+
Potete scrivere un ulteriore `animate` per questo.
66

7-
As the time function we could use `linear`, but something like `makeEaseOut(quad)` looks much better.
7+
Potreste utilizzare la funzione di temporizzazione `linear`, ma qualcosa come `makeEaseOut(quad)` renderà l'animazione migliore.
88

9-
The code:
9+
Il codice:
1010

1111
```js
1212
let height = field.clientHeight - ball.clientHeight;
1313
let width = 100;
1414

15-
// animate top (bouncing)
15+
// anima top (rimbalzo)
1616
animate({
1717
duration: 2000,
1818
timing: makeEaseOut(bounce),
@@ -21,7 +21,7 @@ animate({
2121
}
2222
});
2323

24-
// animate left (moving to the right)
24+
// anima left (sposta verso destra)
2525
animate({
2626
duration: 2000,
2727
timing: makeEaseOut(quad),

Diff for: 7-animation/3-js-animation/2-animate-ball-hops/task.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ importance: 5
22

33
---
44

5-
# Animate the ball bouncing to the right
5+
# Fate rimbalzare la palla verso destra
66

7-
Make the ball bounce to the right. Like this:
7+
Fate rimbalzare la palla verso destra. Come nell'esempio:
88

99
[iframe height=250 src="solution"]
1010

11-
Write the animation code. The distance to the left is `100px`.
11+
Scrivete il codice relativo all'animazione. La distanza da sinistra è `100px`.
1212

13-
Take the solution of the previous task <info:task/animate-ball> as the source.
13+
Prendete la soluzione dell'esercizio precedente <info:task/animate-ball> come punto di partenza.

0 commit comments

Comments
 (0)