Title: | Enhance Your 'Rmarkdown' and 'shiny' Apps with Dazzling Fireworks Celebrations |
---|---|
Description: | Implementation of 'JQuery' <https://jquery.com> and 'CSS' styles to allow the display of fireworks on a document. Toolkit to easily incorporate celebratory splashes in 'Rmarkdown' and 'shiny' apps. |
Authors: | Obinna Obianom [aut, cre] |
Maintainer: | Obinna Obianom <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-11-12 03:24:59 UTC |
Source: | https://github.com/oobianom/r2fireworks |
Add or remove fireworks graphics from page
Add fireworks visuals to page
Remove fireworks visuals from page
Add fireworks visuals to Rmarkdown page
fireworkMessenger( type, duration = NULL, speed = NULL, particleCount = 30, session = getDefaultReactiveDomain() ) showFireworks( speed = 1, particleCount = 40, session = getDefaultReactiveDomain() ) removeFireworks(session = getDefaultReactiveDomain()) addRmdFireworks(speed = 1, particleCount = 40)
fireworkMessenger( type, duration = NULL, speed = NULL, particleCount = 30, session = getDefaultReactiveDomain() ) showFireworks( speed = 1, particleCount = 40, session = getDefaultReactiveDomain() ) removeFireworks(session = getDefaultReactiveDomain()) addRmdFireworks(speed = 1, particleCount = 40)
type |
type of action e.g start, remove |
duration |
duration of fireworks outbursts |
speed |
speed of display of fireworks |
particleCount |
particle size of fireworks |
session |
session object from server |
inclusion or exclusion of fireworks from page
visible firework canvas on the page
removal of firework canvas from the page
addition of firework canvas on the page
# In R markdown documents library(r2fireworks) useFireworks() addRmdFireworks(particleCount = 100, speed = 3)
# In R markdown documents library(r2fireworks) useFireworks() addRmdFireworks(particleCount = 100, speed = 3)
Calls to load fireworks to a page
useFireworks()
useFireworks()
scripts to load fireworks and trigger to start fireworks
More examples and demo pages are located at this link - https://r2fireworks.obi.obianom.com.
# In shiny applications if(interactive()){ # example 1: simple example with automatic start library(shiny) library(r2fireworks) ui <- fluidPage( useFireworks(), shiny::tags$h1("Introducing r2fireworks"), shiny::tags$p("Celebrate 4th of July and my R package!!!") ) server <- function(input, output, session) { # optional. start fireworks on load showFireworks(particleCount = 30) } shinyApp(ui, server) # example 2: sample with start and stop buttons library(shiny) library(r2fireworks) ui <- fluidPage( useFireworks(), shiny::tags$h1("Here is the starts"), shiny::tags$p("Celebrate 4th of July and my R package!!!"), actionButton("startFW","Show and Start Fireworks, with speed x1"), actionButton("startFWx4","Show and Start Fireworks, with speed x4"), actionButton("startFWspx4","Show Fireworks, with particle burst size 10000"), actionButton("stopFW","Remove Fireworks") ) server <- function(input, output, session) { observeEvent(input$startFW,{ showFireworks() }) observeEvent(input$startFWx4,{ showFireworks(speed = 4,particleCount = 50) }) observeEvent(input$startFWspx4,{ showFireworks(speed = 1,particleCount = 10000) }) observeEvent(input$stopFW,{ removeFireworks() }) } }
# In shiny applications if(interactive()){ # example 1: simple example with automatic start library(shiny) library(r2fireworks) ui <- fluidPage( useFireworks(), shiny::tags$h1("Introducing r2fireworks"), shiny::tags$p("Celebrate 4th of July and my R package!!!") ) server <- function(input, output, session) { # optional. start fireworks on load showFireworks(particleCount = 30) } shinyApp(ui, server) # example 2: sample with start and stop buttons library(shiny) library(r2fireworks) ui <- fluidPage( useFireworks(), shiny::tags$h1("Here is the starts"), shiny::tags$p("Celebrate 4th of July and my R package!!!"), actionButton("startFW","Show and Start Fireworks, with speed x1"), actionButton("startFWx4","Show and Start Fireworks, with speed x4"), actionButton("startFWspx4","Show Fireworks, with particle burst size 10000"), actionButton("stopFW","Remove Fireworks") ) server <- function(input, output, session) { observeEvent(input$startFW,{ showFireworks() }) observeEvent(input$startFWx4,{ showFireworks(speed = 4,particleCount = 50) }) observeEvent(input$startFWspx4,{ showFireworks(speed = 1,particleCount = 10000) }) observeEvent(input$stopFW,{ removeFireworks() }) } }