Animate.css Extension for Quarto
Quarto Extension
This extension provides support and shortcode to animate.css.
Animations are only available for HTML-based documents.
Installation
quarto add mcanouil/quarto-animate@1.7.0This will install the extension under the _extensions subdirectory.
If you’re using version control, you will want to check in this directory.
Usage
To animate a text, use the {{< animate >}} shortcode:
Mandatory
<effect>and<text>:{{< animate <effect> "<text>" >}}Optional attributes:
delay,duration,repeat,stagger,direction:{{< animate <effect> "<text>" delay=... duration=... repeat=... stagger=... direction=... >}}delay,duration, andstaggerare CSS times and require a unit (sorms), e.g.,1sor800ms.repeataccepts a positive integer orinfinite.directionaccepts one ofnormal,reverse,alternate, oralternate-reverse.
Invalid values emit a warning and fall back to the default; see https://animate.style/ for more details.
For example:
| Shortcode | Text |
|---|---|
{{< animate bounce "Some text" >}} |
Some text |
{{< animate flip "Some text" repeat=2 >}} |
Some text |
{{< animate hinge "Some text" delay=3s duration=4s repeat=infinite >}} |
Some text |
{{< animate bounce "Some text" direction=alternate >}} |
Some text |
Defining default values for animations can be done in the YAML front matter of your document:
extensions:
animate:
delay: 5s
duration: 10s
repeat: 3
stagger: 0s
direction: normalSequencing with stagger
Pass stagger=<time> to add an incremental delay between sequential shortcode calls in the document. The first call uses the base delay; each subsequent call adds the stagger value on top.
| Shortcode | Text |
|---|---|
{{< animate fadeIn "One" stagger=300ms >}} |
One |
{{< animate fadeIn "Two" stagger=300ms >}} |
Two |
{{< animate fadeIn "Three" stagger=300ms >}} |
Three |
Direction
The direction attribute maps to the CSS animation-direction property and accepts normal, reverse, alternate, or alternate-reverse.
| Shortcode | Text |
|---|---|
{{< animate bounce "Reverse" direction=reverse repeat=2 >}} |
Reverse |
{{< animate bounce "Alternate" direction=alternate repeat=2 >}} |
Alternate |
Special characters
HTML special characters in the animated text are escaped automatically, so quotes, ampersands, and angle brackets render correctly:
{{< animate bounce "Cats & dogs <3" >}}Cats & dogs <3
Advanced
The following won’t work:
{{< animate bounce "[HTML](https://m.canouil.fr/quarto-animate/)" >}}But this will:
[[HTML](https://m.canouil.fr/quarto-animate/)]{.animate__animated .animate__bounce style="display:inline-block;"}Or:
::: {.animate__animated .animate__bounce}
[HTML](https://m.canouil.fr/quarto-animate/)
:::Available Effects
Attention Seekers
bouncebounceflashflashpulsepulserubberBandrubberBandshakeXshakeXshakeYshakeYheadShakeheadShakeswingswingtadatadawobblewobblejellojelloheartBeatheartBeat
Back Entrances
backInDownbackInDownbackInLeftbackInLeftbackInRightbackInRightbackInUpbackInUp
Back Exits
backOutDownbackOutDownbackOutLeftbackOutLeftbackOutRightbackOutRightbackOutUpbackOutUp
Bouncing Entrances
bounceInbounceInbounceInDownbounceInDownbounceInLeftbounceInLeftbounceInRightbounceInRightbounceInUpbounceInUp
Bouncing Exits
bounceOutbounceOutbounceOutDownbounceOutDownbounceOutLeftbounceOutLeftbounceOutRightbounceOutRightbounceOutUpbounceOutUp
Fading Entrances
fadeInfadeInfadeInDownfadeInDownfadeInDownBigfadeInDownBigfadeInLeftfadeInLeftfadeInLeftBigfadeInLeftBigfadeInRightfadeInRightfadeInRightBigfadeInRightBigfadeInUpfadeInUpfadeInUpBigfadeInUpBigfadeInTopLeftfadeInTopLeftfadeInTopRightfadeInTopRightfadeInBottomLeftfadeInBottomLeftfadeInBottomRightfadeInBottomRight
Fading Exits
fadeOutfadeOutfadeOutDownfadeOutDownfadeOutDownBigfadeOutDownBigfadeOutLeftfadeOutLeftfadeOutLeftBigfadeOutLeftBigfadeOutRightfadeOutRightfadeOutRightBigfadeOutRightBigfadeOutUpfadeOutUpfadeOutUpBigfadeOutUpBigfadeOutTopLeftfadeOutTopLeftfadeOutTopRightfadeOutTopRightfadeOutBottomRightfadeOutBottomRightfadeOutBottomLeftfadeOutBottomLeft
Flippers
flipflipflipInXflipInXflipInYflipInYflipOutXflipOutXflipOutYflipOutY
Lightspeed
lightSpeedInRightlightSpeedInRightlightSpeedInLeftlightSpeedInLeftlightSpeedOutRightlightSpeedOutRightlightSpeedOutLeftlightSpeedOutLeft
Rotating Entrances
rotateInrotateInrotateInDownLeftrotateInDownLeftrotateInDownRightrotateInDownRightrotateInUpLeftrotateInUpLeftrotateInUpRightrotateInUpRight
Rotating Exits
rotateOutrotateOutrotateOutDownLeftrotateOutDownLeftrotateOutDownRightrotateOutDownRightrotateOutUpLeftrotateOutUpLeftrotateOutUpRightrotateOutUpRight
Specials
hingehingejackInTheBoxjackInTheBoxrollInrollInrollOutrollOut
Zooming Entrances
zoomInzoomInzoomInDownzoomInDownzoomInLeftzoomInLeftzoomInRightzoomInRightzoomInUpzoomInUp
Zooming Exits
zoomOutzoomOutzoomOutDownzoomOutDownzoomOutLeftzoomOutLeftzoomOutRightzoomOutRightzoomOutUpzoomOutUp
Sliding Entrances
slideInDownslideInLeftslideInRightslideInUp
Sliding Exits
slideOutDownslideOutLeftslideOutRightslideOutUp