Skip to content

Commit 45914c7

Browse files
committed
Animations: add another revealing animation
1 parent 5f8806c commit 45914c7

File tree

1 file changed

+89
-29
lines changed

1 file changed

+89
-29
lines changed

src/customization/animations.md

Lines changed: 89 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Another example with moving bars. Revealing themselves from the bottom.
166166

167167
```css
168168
#animations-example-3 tbody {
169-
overflow-y: hidden;
169+
overflow-y: hidden; /* remove this to see how it works */
170170
}
171171
#animations-example-3 tbody th {
172172
background-color: #fff;
@@ -189,7 +189,7 @@ Another example with moving bars. Revealing themselves from the bottom.
189189
margin: 0 auto;
190190
}
191191
#animations-example-3 tbody {
192-
overflow-y: hidden;
192+
overflow-y: hidden; /* remove this to see how it works */
193193
}
194194
#animations-example-3 tbody th {
195195
background-color: #fff;
@@ -204,7 +204,7 @@ Another example with moving bars. Revealing themselves from the bottom.
204204
}
205205
</template>
206206
<template v-slot:html-code>
207-
<table class="charts-css column hide-data data-spacing-5 show-data-axes" id="animations-example-3">
207+
<table class="charts-css column show-labels hide-data data-spacing-5 show-primary-axis show-data-axes" id="animations-example-3">
208208

209209
<caption> Animation Example #3 </caption>
210210

@@ -242,6 +242,74 @@ Another example with moving bars. Revealing themselves from the bottom.
242242
</template>
243243
</code-example>
244244

245+
The same can be done with less code using `scale()`;
246+
247+
```css
248+
#animations-example-4 tbody td {
249+
transform-origin: bottom;
250+
animation: revealing-bars 4s linear infinite;
251+
}
252+
@keyframes revealing-bars {
253+
0% { transform: scaleY( 0 ); }
254+
15% { transform: scaleY( 1 ); }
255+
}
256+
```
257+
258+
<code-example code-example-id="animations-example-4">
259+
<template v-slot:css-code>
260+
#animations-example-4 {
261+
height: 200px;
262+
max-width: 300px;
263+
margin: 0 auto;
264+
}
265+
#animations-example-4 tbody td {
266+
transform-origin: bottom;
267+
animation: revealing-bars 4s linear infinite;
268+
}
269+
@keyframes revealing-bars {
270+
0% { transform: scaleY( 0 ); }
271+
15% { transform: scaleY( 1 ); }
272+
}
273+
</template>
274+
<template v-slot:html-code>
275+
<table class="charts-css column show-labels hide-data data-spacing-5 show-primary-axis show-data-axes" id="animations-example-4">
276+
277+
<caption> Animation Example #4 </caption>
278+
279+
<thead>
280+
<tr>
281+
<th scope="col"> Year </th>
282+
<th scope="col"> Progress </th>
283+
</tr>
284+
</thead>
285+
286+
<tbody>
287+
<tr>
288+
<th scope="row"> 2016 </th>
289+
<td style="--size: 0.2"> <span class="data"> 20 </span> </td>
290+
</tr>
291+
<tr>
292+
<th scope="row"> 2017 </th>
293+
<td style="--size: 0.4"> <span class="data"> 40 </span> </td>
294+
</tr>
295+
<tr>
296+
<th scope="row"> 2018 </th>
297+
<td style="--size: 0.6"> <span class="data"> 60 </span> </td>
298+
</tr>
299+
<tr>
300+
<th scope="row"> 2019 </th>
301+
<td style="--size: 0.8"> <span class="data"> 80 </span> </td>
302+
</tr>
303+
<tr>
304+
<th scope="row"> 2020 </th>
305+
<td style="--size: 1.0"> <span class="data"> 100 </span> </td>
306+
</tr>
307+
</tbody>
308+
309+
</table>
310+
</template>
311+
</code-example>
312+
245313
## Highlighting Data
246314

247315
A useful example to highlighting individual items with animations.
@@ -256,44 +324,36 @@ A useful example to highlighting individual items with animations.
256324
```
257325

258326
```css
259-
#animations-example-4 .highlighted {
327+
#animations-example-5 .highlighted {
260328
animation: highlighted-bar 2s linear infinite;
261329
}
262330
@keyframes highlighted-bar {
263-
0%,
264-
100% {
265-
box-shadow: none;
266-
}
267-
50% {
268-
box-shadow: 0 0 1px 0 black, 0 0 20px 5px darkgrey;
269-
}
331+
0% { box-shadow: none; }
332+
50% { box-shadow: 0 0 1px 0 black, 0 0 20px 5px darkgrey; }
333+
100% { box-shadow: none; }
270334
}
271335
```
272336

273-
<code-example code-example-id="animations-example-4">
337+
<code-example code-example-id="animations-example-5">
274338
<template v-slot:css-code>
275-
#animations-example-4 {
339+
#animations-example-5 {
276340
height: 200px;
277341
max-width: 350px;
278342
margin: 0 auto;
279343
}
280-
#animations-example-4 .highlighted {
344+
#animations-example-5 .highlighted {
281345
animation: highlighted-bar 2s linear infinite;
282346
}
283347
@keyframes highlighted-bar {
284-
0%,
285-
100% {
286-
box-shadow: none;
287-
}
288-
50% {
289-
box-shadow: 0 0 1px 0 black, 0 0 20px 5px darkgrey;
290-
}
348+
0% { box-shadow: none; }
349+
50% { box-shadow: 0 0 1px 0 black, 0 0 20px 5px darkgrey; }
350+
100% { box-shadow: none; }
291351
}
292352
</template>
293353
<template v-slot:html-code>
294-
<table class="charts-css column show-labels data-spacing-15 show-primary-axis show-data-axes" id="animations-example-4">
354+
<table class="charts-css column show-labels data-spacing-15 show-primary-axis show-data-axes" id="animations-example-5">
295355

296-
<caption> Animation Example #4 </caption>
356+
<caption> Animation Example #5 </caption>
297357

298358
<thead>
299359
<tr>
@@ -334,7 +394,7 @@ A useful example to highlighting individual items with animations.
334394
Now lets animate the colors with gradients.
335395

336396
```css
337-
#animations-example-5 td {
397+
#animations-example-6 td {
338398
background-image: linear-gradient(
339399
45deg,
340400
#956fd3,
@@ -353,14 +413,14 @@ Now lets animate the colors with gradients.
353413
}
354414
```
355415

356-
<code-example code-example-id="animations-example-5">
416+
<code-example code-example-id="animations-example-6">
357417
<template v-slot:css-code>
358-
#animations-example-5 {
418+
#animations-example-6 {
359419
height: 200px;
360420
max-width: 350px;
361421
margin: 0 auto;
362422
}
363-
#animations-example-5 td {
423+
#animations-example-6 td {
364424
background-image: linear-gradient(
365425
45deg,
366426
#956fd3,
@@ -379,9 +439,9 @@ Now lets animate the colors with gradients.
379439
}
380440
</template>
381441
<template v-slot:html-code>
382-
<table class="charts-css column show-labels hide-data data-spacing-5 show-primary-axis show-data-axes" id="animations-example-5">
442+
<table class="charts-css column show-labels hide-data data-spacing-5 show-primary-axis show-data-axes" id="animations-example-6">
383443

384-
<caption> Animation Example #5 </caption>
444+
<caption> Animation Example #6 </caption>
385445

386446
<thead>
387447
<tr>

0 commit comments

Comments
 (0)