Animate on scroll a Shiny or R Markdown element.
aos( element, animation, offset = "120", duration = "400", easing = "ease", delay = "0", anchor = "", anchor_placement = "top-bottom", once = FALSE, ... )
element | An shiny or rmarkdown element. |
---|---|
animation | An animation from AOS |
offset | string. Change offset to trigger animations sooner or later, px |
duration | string. Duration of animation in ms |
easing | string. Choose timing function to ease elements in different ways |
delay | string. Delay animation in ms |
anchor | string. Anchor placement |
anchor_placement | string. Anchor placement - which one position of element on the screen should trigger animation |
once | boolean. |
... | Additional class element |
Javascript code animating the element.
if (interactive()) { library(shiny) shinyApp( ui = fluidPage( use_aos(), # add use_aos() in the UI aos(h1("Shiny with AOS - Animate On Scroll"), animation = "fade-zoom-in"), aos(textOutput("text"), animation = "fade-up") ), server <- function(input, output, session){ output$text <- renderText({ print("An animated text.") }) } ) }