up
This commit is contained in:
parent
3340634eb5
commit
fb99525ba8
5 changed files with 65 additions and 37 deletions
|
@ -40,7 +40,7 @@ Click the button below to animate the background:
|
|||
</script>
|
||||
```
|
||||
|
||||
There are 5 properties to describe CSS transitions:
|
||||
There are 4 properties to describe CSS transitions:
|
||||
|
||||
- `transition-property`
|
||||
- `transition-duration`
|
||||
|
@ -260,9 +260,15 @@ But how to make the Bezier curve for a specific task? There are many tools. For
|
|||
|
||||
Timing function `steps(number of steps[, start/end])` allows to split animation into steps.
|
||||
|
||||
Let's see that in an example with digits. We'll make the digits change not in a smooth, but in a discrete way.
|
||||
Let's see that in an example with digits.
|
||||
|
||||
For that we split the animation into 9 steps:
|
||||
Here's a list of digits, without any animations, just as a source:
|
||||
|
||||
[codetabs src="step-list"]
|
||||
|
||||
We'll make the digits appear in a discrete way by making the part of the list outside of the red "window" invisible and shifting the list to the left with each step.
|
||||
|
||||
There will be 9 steps, a step-move for each digit:
|
||||
|
||||
```css
|
||||
#stripe.animate {
|
||||
|
@ -271,11 +277,11 @@ For that we split the animation into 9 steps:
|
|||
}
|
||||
```
|
||||
|
||||
In action `step(9, start)`:
|
||||
In action:
|
||||
|
||||
[codetabs src="step"]
|
||||
|
||||
The first argument of `steps` is the number of steps. The transform will be split into 9 parts (10% each). The time interval is divided as well: 9 seconds split into 1 second intervals.
|
||||
The first argument of `steps(9, start)` is the number of steps. The transform will be split into 9 parts (10% each). The time interval is automatically divided into 9 parts as well, so `transition: 9s` gives us 9 seconds for the whole animation – 1 second per digit.
|
||||
|
||||
The second argument is one of two words: `start` or `end`.
|
||||
|
||||
|
@ -301,7 +307,7 @@ So the process would go like this:
|
|||
- ...
|
||||
- `9s` -- `-90%`
|
||||
|
||||
In action `step(9, end)`:
|
||||
Here's `step(9, end)` in action (note the pause between the first digit change):
|
||||
|
||||
[codetabs src="step-end"]
|
||||
|
||||
|
|
14
3-animation/2-css-animations/step-list.view/index.html
Normal file
14
3-animation/2-css-animations/step-list.view/index.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="digit"><div id="stripe">0123456789</div></div>
|
||||
|
||||
</body>
|
||||
</html>
|
9
3-animation/2-css-animations/step-list.view/style.css
Normal file
9
3-animation/2-css-animations/step-list.view/style.css
Normal file
|
@ -0,0 +1,9 @@
|
|||
#digit {
|
||||
border: 1px solid red;
|
||||
width: 1.2em;
|
||||
}
|
||||
|
||||
#stripe {
|
||||
display: inline-block;
|
||||
font: 32px monospace;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue