Skip to contents

Sets the duration, easing, and per-element stagger for the enter/update/exit animations used across chart layers. All arguments are optional; any left NULL keeps the chart's current behavior, so this setter is fully additive and backward compatible.

Usage

setTransition(myIO, duration = NULL, easing = NULL, stagger = NULL)

Arguments

myIO

an htmlwidget object created by the myIO() function

duration

transition duration in milliseconds (>= 0). Set to 0 to disable animation.

easing

easing function name, one of "linear", "quad", "cubic", "sin", "exp", "circle", "back", "bounce", or "elastic" (mapped to the corresponding 'd3.js' easing). When NULL, each renderer keeps its built-in default easing.

stagger

per-element delay in milliseconds (>= 0) applied across a layer's joined elements, creating a cascade. 0 disables stagger.

Value

A modified myIO htmlwidget object with updated transition settings.

Details

Animation remains fully opt-out-able: duration = 0 (or setTransitionSpeed(0)) disables animation, and easing and stagger automatically no-op whenever the effective duration is 0 — including when the viewer's system requests prefers-reduced-motion: reduce.

See also

setTransitionSpeed for the duration-only shorthand.

Examples

# Slower transitions with a bouncing ease and a 25ms cascade
myIO() |> setTransition(duration = 1200, easing = "bounce", stagger = 25)
# Change only the easing myIO() |> setTransition(easing = "cubic")
# Disable animation entirely myIO() |> setTransition(duration = 0)