Package 'shinyanimate'

Title: Animation for 'shiny' Elements
Description: An extension of 'animate.css' that allows user to easily add animations to any UI element in 'shiny' app using the elements id.
Authors: Swechhya Bista
Maintainer: Swechhya Bista <[email protected]>
License: MIT + file LICENSE
Version: 0.4.0
Built: 2024-11-08 04:27:27 UTC
Source: https://github.com/swechhya/shinyanimate

Help Index


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

withAnim

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

withAnim

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

withAnim

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

startAnim

Examples

if(interactive()){withAnim()}