Greatly enhance the shiny::icon with animations. Built on top of font-awesome-animation.
animateIcon(
name,
animation = NULL,
speed = NULL,
hover = FALSE,
color = "",
size = NULL,
...
)
string, the name of the font-awesome icon
what kind of animation you want, one of "wrench", "ring", "horizontal", "horizontal-reverse", "vertical", "flash", "bounce", "bounce-reverse", "spin", "spin-reverse", "float", "pulse", "shake", "tada", "passing", "passing-reverse", "burst", "falling", "falling-reverse", "rising"s See our online demo for details.
string, one of "fast", "slow"
bool, trigger animation on hover?
string, color of the icon, a valid color name or hex code
string, change font-awesome icon size, one of "xs", "sm", "lg", "2x", "3x", "5x", "7x", "10x". See examples.
append additional attributes you want to the icon
a icon tag
If you don't specify any animation, it will work the same as the original shiny::icon function. Fully compatible with any shiny functions that requires an icon as input.
if(interactive()){
library(shiny)
ui <- fluidPage(
style = "text-align: center;",
tags$label("same as original icon function"), br(),
animateIcon("house"), br(),
tags$label("Change animation and color"), br(),
animateIcon(
name = "house", animation = "horizontal", speed = "slow", color ="red"
), br(),
tags$label("work in a button"), br(),
actionButton(
"a", "a", icon = animateIcon("spinner", "spin", "fast")
), br(),
tags$label("hover your mouse on the next one"), br(),
animateIcon(
name = "wrench", animation = "wrench", hover = TRUE, color ="green"
), br(),
tags$label("change size"), br(),
animateIcon("house"),
animateIcon("house", size = "xs"),
animateIcon("house", size = "sm"),
animateIcon("house", size = "lg"),
animateIcon("house", size = "2x"),
animateIcon("house", size = "3x"),
animateIcon("house", size = "5x"),
animateIcon("house", size = "7x"),
animateIcon("house", size = "10x")
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
}