Animate on Scroll Library for Shiny

The package aos allows to animate on scroll elements in R Shiny thanks to AOS - Animate On Scroll.


Install the released version from CRAN.

To get a bug fix, or use a feature from the development version, you can install it from GitHub.


In order to use the {aos} package, you must first call use_aos() in the apps’ UI.

Then simply apply aos() to any Shiny element with an animation and other arguments such as duration, delay or easing.

The function aos() doesn’t work (yet) with htmlwidgets.

Customize your animations

The use_aos() allows to parameter global settings as well as overrid default aos() arguments.

For example, you can change the offset to trigger animations later (200px instead of the default 120px), the duration of the animations (600ms instead of 400ms), the easing (“ease-in-sine” instead of “ease”), the delay (300ms instead of 0ms) or disable the animation for mobile phones (global setting).

Check out the aos documentation to learn about all the attributes available for use_aos() and aos().

The arguments duration and delay accept only values from “50” to “3000”, with step 50ms.

The attribute anchor_placement allows to set different placement option, for example top-center, i.e. the animation will be triggered when top of element will reach center of the window.

R Markdown

To animate a element of a R Markdown document, you must first call use_aos() inside a R code chunk with {r, echo = FALSE} so the code will not be shown in the final document.

Then you can animate any content of your R Markdown document using the ::: markers of the rmarkdown package followed by {data-aos="ANIMATION_EFFECT" data-aos-ARGUMENT="ARGUMENT_OPTION"}. The animation effects are listed in the documentation here.

Below an example with the “fade-up” animation with other arguments.