animateIcon {spsComps}R Documentation

Font awesome animated icons

Description

Greatly enhance the shiny::icon with animations. Built on top of font-awesome-animation.

Usage

animateIcon(
  name,
  animation = NULL,
  speed = NULL,
  hover = FALSE,
  color = "",
  size = NULL,
  ...
)

Arguments

name

string, the name of the font-awesome icon

animation

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.

speed

string, one of "fast", "slow"

hover

bool, trigger animation on hover?

color

string, color of the icon, a valid color name or hex code

size

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

Details

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.

Value

a icon tag

Examples

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)
}

[Package spsComps version 0.3.3.0 Index]