Animation playground
Tweak the animation settings, and copy the resulting CSS variables.
Try it
If you change a setting and press Set, the charts in view build again. The other charts build with the new settings when they are scrolled into view. On a wide screen, the sliders stay in view while the page scrolls. A setting that is not changed keeps its default.
The pink part of a slider shows where the other setting holds it back, for the number of columns and bars under the sliders. The stagger and the maximum depend on each other: the more columns or bars a chart has, the sooner the maximum moves the starts closer together.
The maximum always wins. If it holds the stagger back, a hollow mark on the stagger slider shows the stagger that is used, and the value beside the slider shows both, such as 0.6 → 0.10. Your CSS keeps the stagger you set: on a chart with fewer columns, it is used as it is.
| 1 | 20 |
|---|---|
| 2 | 57 |
| 3 | 34 |
| 4 | 71 |
| 5 | 48 |
| 6 | 25 |
| 7 | 62 |
| 8 | 39 |
| 9 | 76 |
| 10 | 53 |
| 1 | 20 |
|---|---|
| 2 | 57 |
| 3 | 34 |
| 4 | 71 |
| 5 | 48 |
| 6 | 25 |
| 7 | 62 |
| 8 | 39 |
| 9 | 76 |
| 10 | 53 |
| Jan | 42 |
|---|---|
| Feb | 45 |
| Mar | 51 |
| Apr | 49 |
| May | 58 |
| Jun | 63 |
| Jul | 61 |
| Aug | 67 |
| Sep | 72 |
| Oct | 70 |
| Nov | 76 |
| Dec | 81 |
| Elstar | 42 |
|---|---|
| Jonagold | 28 |
| Braeburn | 18 |
| Gala | 12 |
| Start | 120 |
|---|---|
| Sold | -45 |
| Picked | 60 |
| Spoiled | -12 |
| End | 123 |
A waterfall multiplies the stagger by 2.4, so it builds column by column. If you want it to build like the other charts, set --tablechart-waterfall-stagger-factor to 1.
The settings
- Speed
- Faster or slower than the defaults, as a factor: 1.25 is a quarter faster, 0.8 is slower. Every time is divided by it, also an element time or a maximum you set. Default: 1.
- Element time
- How long one bar, column, point or slice takes. Default: 0.4s.
- Stagger
- When the next element starts, as a share of the element time. At 0 all start together, at 1 each waits for the one before it. Default: 0.25. Note that a waterfall multiplies it by 2.4, so it builds column by column. If you want it to build like the other charts, set
--tablechart-waterfall-stagger-factorto1. - Minimum
- The shortest a whole chart takes. If a chart would end sooner, its columns and their starts slow down together until it takes this long. Default: 0.5s.
- Maximum
- The longest a whole chart may take. Above it, the starts move closer together. Default: 2s.
- Easing
- How a movement speeds up and slows down. Default: ease-in-out.
Your CSS
Only the settings you changed are in it.
The settings are kept in this browser only, so they are still here when you come back. They do not go anywhere else. If you want to use them on your own site, in a Reveal.js presentation or with Tablechart from npm, add the CSS to your own stylesheet. On :root they hold for every chart on the page. You can also put them on one figure, or on a section with several charts. In Reveal.js, .reveal works as well.