| anime_text | R Documentation |
Constructs a text-swap specification for use in the props argument of
anime_add(). Unlike a numeric tween, a text prop does not interpolate:
the values are spread evenly across the segment's duration and the target
element's textContent is swapped to the value for the current position as
the timeline plays or is scrubbed. Useful for animated titles, counters,
and tickers.
anime_text(values)
values |
An atomic vector of the successive text values. Non-character
vectors are coerced with |
The segment's selector picks the text element(s) to update, so the prop
name you file this under is only a label; use something descriptive such as
text or label.
An anime_text object.
# A counter that steps through four values across the segment
anime_add(
anime_timeline(),
selector = anime_target_id("counter"),
props = list(text = anime_text(c("0", "25", "50", "100")))
)
# Compose a text swap with an ordinary tween on the same segment
anime_add(
anime_timeline(),
selector = anime_target_id("title"),
props = list(
opacity = anime_keyframes(0, 1),
label = anime_text(c("Loading", "Ready"))
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.