Skip to content

Commit aa521b9

Browse files
committed
ok
1 parent 3285348 commit aa521b9

File tree

18 files changed

+192
-234
lines changed

18 files changed

+192
-234
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11

2-
CSS-код для анимации одновременно `width` и `height`:
2+
CSS to animate both `width` and `height`:
33
```css
4-
/* исходный класс */
4+
/* original class */
55

66
#flyjet {
77
transition: all 3s;
88
}
9-
/* JS добавляет .growing *.
9+
10+
/* JS adds .growing */
1011
#flyjet.growing {
1112
width: 400px;
1213
height: 240px;
1314
}
1415
```
1516

16-
Небольшая тонкость с окончанием анимации. Соответствующее событие `transitionend` сработает два раза -- по одному для каждого свойства. Поэтому, если не предпринять дополнительных шагов, сообщение из обработчика может быть выведено 2 раза.
17+
Please note that `transitionend` triggers two times -- once for every property. So if we don't perform an additional check then the message would show up 2 times.

5-animation/2-css-animations/1-animate-logo-css/solution.view/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
height: 24px;
1515
transition: all 3s;
1616
}
17-
17+
1818
#flyjet.growing {
1919
width: 400px;
2020
height: 240px;
@@ -24,7 +24,7 @@
2424

2525
<body>
2626

27-
<img id="flyjet" src="https://js.cx/clipart/flyjet.jpg">
27+
<img id="flyjet" src="https://en.js.cx/clipart/flyjet.jpg">
2828

2929
<script>
3030
flyjet.onclick = function() {
@@ -34,7 +34,7 @@
3434
flyjet.addEventListener('transitionend', function() {
3535
if (!ended) {
3636
ended = true;
37-
alert('Готово!');
37+
alert('Done!');
3838
}
3939
});
4040

@@ -44,4 +44,4 @@
4444

4545
</body>
4646

47-
</html>
47+
</html>

5-animation/2-css-animations/1-animate-logo-css/source.view/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#flyjet {
1313
width: 40px;
1414
/* -> 400px */
15-
15+
1616
height: 24px;
1717
/* -> 240px */
1818
}
@@ -21,9 +21,9 @@
2121

2222
<body>
2323

24-
<img id="flyjet" src="https://js.cx/clipart/flyjet.jpg">
24+
<img id="flyjet" src="https://en.js.cx/clipart/flyjet.jpg">
2525

2626

2727
</body>
2828

29-
</html>
29+
</html>

5-animation/2-css-animations/1-animate-logo-css/task.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ importance: 5
22

33
---
44

5-
# Анимировать самолёт (CSS)
5+
# Animate a plane (CSS)
66

7-
Реализуйте анимацию, как в демке ниже (клик на картинку):
7+
Show the animation like on the picture below (click the plane):
88

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

11-
- Изображение растёт при клике с 40x24px до 400x240px .
12-
- Продолжительность анимации: 3 секунды.
13-
- По окончании вывести "Готово!".
14-
- Если в процессе анимации были дополнительные клики -- они не должны ничего "сломать".
15-
11+
- The picture grows on click from 40x24px to 400x240px.
12+
- The animation takes 3 seconds.
13+
- At the end output: "Done!".
14+
- During the animation process, there may be more clicks. They shouldn't "break" anything.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Для такой анимации необходимо подобрать правильную кривую Безье.
1+
We need to choose the right Bezier curve for that animation. It should have `y>1` somewhere for the plane to "jump out".
22

3-
Чтобы она выпрыгивала вверх, обе опорные точки можно вынести по `y>1`, например: `cubic-bezier(0.25, 1.5, 0.75, 1.5)` (промежуточные опорные точки имеют `y=1.5`).
3+
For instance, we can take both control points with `y>1`, like: `cubic-bezier(0.25, 1.5, 0.75, 1.5)`.
44

5-
Её график:
5+
The graph:
66

7-
![](bezier-up.png)
7+
![](bezier-up.png)

5-animation/2-css-animations/2-animate-logo-bezier-css/solution.view/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
height: 24px;
1616
transition: all 3s cubic-bezier(0.25, 1.5, 0.75, 1.5);
1717
}
18-
18+
1919
#flyjet.growing {
2020
width: 400px;
2121
height: 240px;
@@ -25,14 +25,14 @@
2525

2626
<body>
2727

28-
<img id="flyjet" src="https://js.cx/clipart/flyjet.jpg">
28+
<img id="flyjet" src="https://en.js.cx/clipart/flyjet.jpg">
2929

3030
<script>
3131
flyjet.onclick = function() {
3232
flyjet.classList.add('growing');
33-
}
33+
};
3434
</script>
3535

3636
</body>
3737

38-
</html>
38+
</html>

5-animation/2-css-animations/2-animate-logo-bezier-css/task.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ importance: 5
22

33
---
44

5-
# Анимировать самолёт с перелётом (CSS)
5+
# Animate the flying plane (CSS)
66

7-
Модифицируйте решение предыдущей задачи <info:task/animate-logo-css>, чтобы в процессе анимации изображение выросло больше своего стандартного размера 400x240px ("выпрыгнуло"), а затем вернулось к нему.
7+
Modify the solution of the previous task <info:task/animate-logo-css> to make the plane grow more than it's original size 400x240px (jump out), and then return to that size.
88

9-
Должно получиться как здесь (клик на картинку)
9+
Here's how it should look (click on the plane):
1010

1111
[iframe src="solution" height=350]
1212

13-
В качестве исходного документа возьмите решение предыдущей задачи.
13+
Take the solution of the previous task as the source.

5-animation/3-js-animation/1-animate-ball/solution.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
В HTML/CSS, падение мяча можно отобразить изменением свойства `ball.style.top` от 0 и до значения, соответствующего нижнему положению.
1+
To bounce we can use CSS property `top` and `position:absolute` for the ball inside the field with `position:relative`.
22

3-
Нижняя граница элемента `field`, в котором находится мяч, имеет значение `field.clientHeight`. Но свойство `top` относится к верху мяча, поэтому оно меняется до `field.clientHeight - ball.clientHeight`.
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`.
44

5-
Для создания анимационного эффекта лучше всего подойдет функция `bounce` в режиме `easeOut`.
5+
So we animate the `top` from `0` to `field.clientHeight - ball.clientHeight`.
66

7-
Следующий код даст нам нужный результат:
7+
Now to get the "bouncing" effect we can use the timing function `bounce` in `easeOut` mode.
8+
9+
Here's the final code for the animation:
810

911
```js
1012
let to = field.clientHeight - ball.clientHeight;
1113

1214
animate({
1315
duration: 2000,
1416
timing: makeEaseOut(bounce),
15-
draw: function(progress) {
17+
draw(progress) {
1618
ball.style.top = to * progress + 'px'
1719
}
1820
});
1921
```
20-

5-animation/3-js-animation/1-animate-ball/solution.view/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
animate({
3636
duration: 2000,
3737
timing: makeEaseOut(bounce),
38-
draw: function(progress) {
38+
draw(progress) {
3939
ball.style.top = to * progress + 'px'
4040
}
4141
});
@@ -48,4 +48,4 @@
4848

4949
</body>
5050

51-
</html>
51+
</html>

5-animation/3-js-animation/1-animate-ball/source.view/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
<html>
33

44
<head>
5-
<script src="https://js.cx/libs/animate.js"></script>
5+
<script src="https://en.js.cx/libs/animate.js"></script>
66
<link rel="stylesheet" href="style.css">
77
</head>
88

99
<body>
1010

1111

1212
<div id="field">
13-
<img src="https://js.cx/clipart/ball.svg" width="40" height="40" id="ball">
13+
<img src="https://en.js.cx/clipart/ball.svg" width="40" height="40" id="ball">
1414
</div>
1515

1616

1717
</body>
1818

19-
</html>
19+
</html>

0 commit comments

Comments
 (0)