|
1 | 1 |
|
2 |
| -# Animated circle with callback |
| 2 | +# Cerc animat cu callback |
3 | 3 |
|
4 |
| -In the task <info:task/animate-circle> an animated growing circle is shown. |
| 4 | +În sarcina <info:task/animate-circle> este afișat un cerc animat în creștere. |
5 | 5 |
|
6 |
| -Now let's say we need not just a circle, but to show a message inside it. The message should appear *after* the animation is complete (the circle is fully grown), otherwise it would look ugly. |
| 6 | +Acum să spunem că avem nevoie nu doar de un cerc, ci și de un mesaj în interiorul acestuia. Mesajul ar trebui să apară *după* finalizarea animației (cercul a crescut complet), altfel ar arăta urât. |
7 | 7 |
|
8 |
| -In the solution of the task, the function `showCircle(cx, cy, radius)` draws the circle, but gives no way to track when it's ready. |
| 8 | +În soluția sarcinii, funcția `showCircle(cx, cy, radius)` desenează cercul, dar nu oferă nicio modalitate de a urmări când este gata. |
9 | 9 |
|
10 |
| -Add a callback argument: `showCircle(cx, cy, radius, callback)` to be called when the animation is complete. The `callback` should receive the circle `<div>` as an argument. |
| 10 | +Adăugați un argument de callback: `showCircle(cx, cy, radius, callback)` care va fi apelată atunci când animația este finalizată. `callback`-ul trebuie să primească `<div>`-ul cercului ca argument. |
11 | 11 |
|
12 |
| -Here's the example: |
| 12 | +Iată exemplul: |
13 | 13 |
|
14 | 14 | ```js
|
15 | 15 | showCircle(150, 150, 100, div => {
|
16 | 16 | div.classList.add('message-ball');
|
17 |
| - div.append("Hello, world!"); |
| 17 | + div.append("Salut, lume!"); |
18 | 18 | });
|
19 | 19 | ```
|
20 | 20 |
|
21 | 21 | Demo:
|
22 | 22 |
|
23 | 23 | [iframe src="solution" height=260]
|
24 | 24 |
|
25 |
| -Take the solution of the task <info:task/animate-circle> as the base. |
| 25 | +Luați ca bază soluția sarcinii <info:task/animate-circle>. |
0 commit comments