Package 'sparkler'

Title: Visual Effects and Atmospheric Overlays for 'Shiny' and 'R Markdown'
Description: Add lightweight visual effects to Shiny applications, R Markdown documents, and Quarto presentations using htmlwidgets. The package includes celebratory effects such as confetti and fireworks, along with atmospheric effects such as snow, rain, and meteors. Effects can be used as full-screen overlays or, for selected effects, within contained regions for storytelling, highlighting, and presentation design.
Authors: Tiger Tang [aut, cre]
Maintainer: Tiger Tang <[email protected]>
License: GPL (>= 3)
Version: 0.1.1
Built: 2026-05-19 05:53:19 UTC
Source: https://github.com/CodingTigerTang/sparkler

Help Index


Launch Confetti

Description

Triggers a confetti explosion to the Shiny app or Quarto/RMarkdown document.

Usage

confetti(
  particle_count = 100,
  spread = 70,
  width = NULL,
  height = NULL,
  elementId = NULL
)

confettiOutput(outputId, width = "100%", height = "0px")

renderConfetti(expr, env = parent.frame(), quoted = FALSE)

Arguments

particle_count

Integer. Number of particles to fire (default 150).

spread

Integer. How wide the explosion is in degrees (default 100).

width

Must be a valid CSS unit (like '100%', '400px', 'auto') or a number.

height

Must be a valid CSS unit (like '100%', '400px', 'auto') or a number.

elementId

Use an explicit element ID for the widget (optional).

outputId

output variable to read from

expr

An expression that generates a confetti

env

The environment in which to evaluate expr.

quoted

Is expr a quoted expression (with quote())?


Launch Fireworks

Description

Triggers a fireworks display to the Shiny app or Quarto/RMarkdown document.

Usage

fireworks(
  duration = 5,
  speed = 1,
  width = "100%",
  height = "0px",
  elementId = NULL
)

fireworksOutput(outputId, width = "100%", height = "0px")

renderFireworks(expr, env = parent.frame(), quoted = FALSE)

Arguments

duration

Number of seconds to run (default 5).

speed

Number. Speed of simulation (default 1).

width

Must be a valid CSS unit (like '100%', '400px', 'auto') or a number.

height

Must be a valid CSS unit (like '100%', '400px', 'auto') or a number.

elementId

Optional ID.

outputId

output variable to read from

expr

An expression that generates fireworks

env

The environment in which to evaluate expr.

quoted

Is expr a quoted expression?


Run the Sparkler Demo App

Description

Launches a Shiny app showcasing confetti, fireworks, and weather effects.

Usage

run_demo()

Start Weather Effect

Description

Adds a full-screen overlay of rain, snow, or meteors to the Shiny app or Quarto/RMarkdown document.

Usage

weather(
  type = "snow",
  density = 1,
  speed = 1,
  fullscreen = NULL,
  width = NULL,
  height = NULL,
  elementId = NULL
)

weatherOutput(outputId, width = "100%", height = "0px")

renderWeather(expr, env = parent.frame(), quoted = FALSE)

Arguments

type

Character. One of "snow", "rain", "meteor", or "none" (to stop the effect).

density

Numeric. Multiplier for particle count (default 1).

speed

Numeric. Multiplier for movement speed (default 1).

fullscreen

Logical. If TRUE, forces the effect to cover the whole page (useful for RMarkdown). If NULL (default), it auto-detects if you are in Shiny.

width

Must be a valid CSS unit (like '100%', '400px', 'auto') or a number.

height

Must be a valid CSS unit (like '100%', '400px', 'auto') or a number.

elementId

Optional ID.

outputId

output variable to read from

expr

An expression that generates weather

env

The environment in which to evaluate expr.

quoted

Is expr a quoted expression?