animateIcon: Font awesome animated icons

Description Usage Arguments Details Value Examples

View source: R/font_awesome_animate.R

Description

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

Usage

1
2
3
4
5
6
7
8
9
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
if(interactive()){
  library(shiny)

  ui <- fluidPage(
    style = "text-align: center;",
    tags$label("same as original icon function"), br(),
    animateIcon("home"),  br(),
    tags$label("Change animation and color"), br(),
    animateIcon(
      name = "home", 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("home"),
    animateIcon("home", size = "xs"),
    animateIcon("home", size = "sm"),
    animateIcon("home", size = "lg"),
    animateIcon("home", size = "2x"),
    animateIcon("home", size = "3x"),
    animateIcon("home", size = "5x"),
    animateIcon("home", size = "7x"),
    animateIcon("home", size = "10x")
  )

  server <- function(input, output, session) {

  }

  shinyApp(ui, server)
}

spsComps documentation built on Feb. 3, 2022, 1:07 a.m.