Type: | Package |
Title: | Animate 'shiny' Elements when They Scroll into View using the 'scrollrevealjs' Library |
Version: | 0.2.0 |
Description: | Allows the user to animate 'shiny' elements when scrolling to view them. The animations are activated using the 'scrollrevealjs' library. See https://scrollrevealjs.org/ for more information. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
URL: | https://github.com/feddelegrand7/scrollrevealR |
BugReports: | https://github.com/feddelegrand7/scrollrevealR/issues |
Imports: | htmltools, glue |
Suggests: | knitr, rmarkdown |
VignetteBuilder: | knitr |
RoxygenNote: | 7.1.1 |
NeedsCompilation: | no |
Packaged: | 2020-10-14 09:31:57 UTC; Administrateur |
Author: | Mohamed El Fodil Ihaddaden [aut, cre], Julian Lloyd [ctb, cph] (scrollreveal.js library developer) |
Maintainer: | Mohamed El Fodil Ihaddaden <ihaddaden.fodeil@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2020-10-14 10:00:02 UTC |
Animate elements when scrolling to view them
Description
Animate elements when scrolling to view them
Usage
scroll_reveal(
target,
duration = 1000,
delay = 100,
distance = "20px",
origin = "bottom",
reset = TRUE
)
Arguments
target |
The elements to animate as they scroll into view |
duration |
The duration of the animation in milliseconds. Defaults to 1000 ms |
delay |
The desired delay in milliseconds before triggering the animation. Defaults to 100 ms |
distance |
Controls how far elements move when revealed. Defaults to 20px |
origin |
Specifies what direction elements come from when revealed ("top", "bottom", "right", "left"). Defaults to "bottom" |
reset |
logical, should the function animate the element each time it scrolls into view or only once. Defaults to TRUE. |
Value
An animated shiny element
Examples
if (interactive()) {
ui <- fluidPage(
h1("TIME"),
br(),
br(),
h1("SPACE"),
br(),
br(),
h1("PIZZA"),
br(),
br(),
br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(),
br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(),
br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(),
br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(),
# Using the scroll_reveal() function
scroll_reveal(target = "h1", duration = 2000, distance = "100px"),
)
server <- function(input, output) {
}
shinyApp(ui = ui, server = server)
}
Create an HTML dependency for scrollreveal.js
Description
Create an HTML dependency for scrollreveal.js
Usage
scrollreveal_dep()