| animate | R Documentation |
Changes a numeric field of a widget (e.g. value of a progress_bar(),
offset_y of a scroll_view(), count of a custom widget) smoothly
from its current value to to. Starting a new animation of the same
field replaces the running one. Animations stop when the widget is
removed or the app exits.
animate(
widget,
property,
to,
duration = 0.3,
easing = "out_cubic",
from = NULL,
on_complete = NULL
)
widget |
A widget attached to a running app. |
property |
Name of a numeric field. |
to |
Target value. |
duration |
Seconds. |
easing |
|
from |
Start value (default: the current value). |
on_complete |
Optional |
An Animation handle with cancel().
bar <- progress_bar(id = "progress")
pilot <- test_app(app(bar), width = 30, height = 1)
animate(pilot$query_one("#progress"), "value", to = 1, duration = 0.5)
pilot$advance(1)
bar$value
pilot$stop()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.