anime_add: Add an animation segment to a timeline

View source: R/timeline.R

anime_addR Documentation

Add an animation segment to a timeline

Description

Pipe-friendly. Each call appends one segment: a set of CSS property animations applied to a target selector.

Usage

anime_add(
  timeline,
  selector,
  props,
  offset = "+=0",
  duration = NULL,
  ease = NULL,
  delay = NULL,
  stagger = NULL
)

Arguments

timeline

An anime_timeline object.

selector

CSS selector string identifying the SVG/HTML elements to animate. Use ⁠anime_target_*()⁠ helpers to construct selectors.

props

A named list of property animations. Values may be scalars, two-element numeric vectors (from/to), anime_from_to() objects, or anime_keyframes() objects.

offset

Timeline position. "+=N" means N ms after the previous segment ends; a bare number is an absolute position in ms.

duration

Overrides the timeline default for this segment.

ease

Overrides the timeline default for this segment.

delay

Overrides the timeline default for this segment.

stagger

An anime_stagger object for per-element delay offsets.

Value

The modified anime_timeline object.

Examples

anime_timeline() |>
  anime_add(
    selector = anime_target_class("circle"),
    props    = list(opacity = anime_from_to(0, 1)),
    duration = 600
  )


animejs documentation built on Aug. 21, 2026, 5:17 p.m.