Type: | Package |
Title: | Animation for 'shiny' Elements |
Version: | 0.4.0 |
Author: | Swechhya Bista |
Maintainer: | Swechhya Bista <swechhyabista@gmail.com> |
Description: | An extension of 'animate.css' that allows user to easily add animations to any UI element in 'shiny' app using the elements id. |
Imports: | shiny |
License: | MIT + file LICENSE |
URL: | https://github.com/Swechhya/shinyanimate |
BugReports: | https://github.com/Swechhya/shinyanimate/issues |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
NeedsCompilation: | no |
Packaged: | 2023-10-30 11:12:48 UTC; swechhya |
Repository: | CRAN |
Date/Publication: | 2023-10-30 11:30:02 UTC |
Add animation on mouse hover for UI element.
Description
Add animation on mouse hover for UI element.
Usage
addHoverAnim(session, id, type = NULL)
Arguments
session |
The session object passed to function given to shinyServer. |
id |
the id of the UI element for which you want animation on mouse hover. |
type |
The type of animation to use, valid values correspond to the types in https://daneden.github.io/animate.css/ |
See Also
Examples
if(interactive()){
library(shiny)
library(shinyanimate)
ui <- fluidPage(
withAnim(),
tags$div(id = 'title', h1('HOVER ON ME'))
)
server <- function(input, output, session){
observe(addHoverAnim(session, 'title', 'bounce'))
}
shinyApp(ui, server)
}
Add animation on scroll for UI element.
Description
Add animation on scroll for UI element.
Usage
addScrollAnim(session, id, type = NULL)
Arguments
session |
The session object passed to function given to shinyServer. |
id |
the id of the UI element for which you want animation on scroll. |
type |
The type of animation to use, valid values correspond to the types in https://daneden.github.io/animate.css/ |
See Also
Examples
if(interactive()){
library(shiny)
library(shinyanimate)
ui <- fluidPage(
withAnim(),
tags$h1('Scroll below to see an animation'),
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(),
tags$div(id = 'title', h1('I ANIMATE ON SCROLL'))
)
server <- function(input, output, session){
observe(addScrollAnim(session, 'title', 'bounce'))
}
shinyApp(ui, server)
}
Start an animation
Description
Start an animation of the UI element.
Usage
startAnim(session, id, type = NULL, delay = NULL)
Arguments
session |
The session object passed to function given to shinyServer. |
id |
the id of the UI element for which you want to add animation. |
type |
The type of animation to use, valid values correspond to the types in https://daneden.github.io/animate.css/ |
delay |
The time after which you want to add animationin milliseconds |
See Also
Examples
if(interactive()){
library(shiny)
library(shinyanimate)
ui <- fluidPage(
withAnim(),
tags$div(id = 'title', h1('ANIMATION')),
actionButton(inputId = "button", label = "Animate")
)
server <- function(input, output, session){
observeEvent(input$button,{
startAnim(session, 'title', 'bounce')
})
}
shinyApp(ui, server)
}
Set up Shiny app to use animation
Description
This function needs to be added in the UI if to want to add animation to your UI elements using shinyanimate.
Usage
withAnim()
See Also
Examples
if(interactive()){withAnim()}