Skip to content

Commit 6f0a934

Browse files
authored
Animations: Add chart animation (ChartsCSS#56)
1 parent ba66b67 commit 6f0a934

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

src/customization/animations.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,3 +481,78 @@ Now lets animate colors with gradients:
481481
</div>
482482
</template>
483483
</code-example>
484+
485+
## Chart Animation
486+
487+
Finally lets animate the chart:
488+
489+
```css
490+
#animations-example .column {
491+
animation: chart-animation 2s ease-out infinite;
492+
}
493+
@keyframes chart-animation {
494+
0% { transform: scale(1); }
495+
20% { transform: scaleY(0.95) scaleX(1.05); }
496+
48% { transform: scaleY(1.10) scaleX(0.90); }
497+
68% { transform: scaleY(0.98) scaleX(1.02); }
498+
80% { transform: scaleY(1.02) scaleX(0.98); }
499+
100% { transform: scale(1); }
500+
}
501+
```
502+
503+
<code-example code-example-id="animations-example-7">
504+
<template v-slot:css-code>
505+
#animations-example-7 {
506+
width: 100%;
507+
max-width: 350px;
508+
margin: 0 auto;
509+
}
510+
#animations-example-7 .column {
511+
--aspect-ratio: 4 / 3;
512+
animation: chart-animation 2s ease-out infinite;
513+
}
514+
@keyframes chart-animation {
515+
0% { transform: scale(1); }
516+
20% { transform: scaleY(0.95) scaleX(1.05); }
517+
48% { transform: scaleY(1.10) scaleX(0.90); }
518+
68% { transform: scaleY(0.98) scaleX(1.02); }
519+
80% { transform: scaleY(1.02) scaleX(0.98); }
520+
100% { transform: scale(1); }
521+
}
522+
</template>
523+
<template v-slot:html-code>
524+
<div id="animations-example-7">
525+
<table class="charts-css column show-labels hide-data data-spacing-5 show-primary-axis">
526+
<caption> Animation Example #7 </caption>
527+
<thead>
528+
<tr>
529+
<th scope="col"> Year </th>
530+
<th scope="col"> Progress </th>
531+
</tr>
532+
</thead>
533+
<tbody>
534+
<tr>
535+
<th scope="row"> 2016 </th>
536+
<td style="--size: 0.2"> <span class="data"> 20 </span> </td>
537+
</tr>
538+
<tr>
539+
<th scope="row"> 2017 </th>
540+
<td style="--size: 0.4"> <span class="data"> 40 </span> </td>
541+
</tr>
542+
<tr>
543+
<th scope="row"> 2018 </th>
544+
<td style="--size: 1.0"> <span class="data"> 100 </span> </td>
545+
</tr>
546+
<tr>
547+
<th scope="row"> 2019 </th>
548+
<td style="--size: 0.5"> <span class="data"> 50 </span> </td>
549+
</tr>
550+
<tr>
551+
<th scope="row"> 2020 </th>
552+
<td style="--size: 0.3"> <span class="data"> 30 </span> </td>
553+
</tr>
554+
</tbody>
555+
</table>
556+
</div>
557+
</template>
558+
</code-example>

0 commit comments

Comments
 (0)