ViewJsonAnimator
What is ViewJsonAnimator?
ViewJsonAnimator
is a lightweight, high-performance animator that updates SceneGraph renderer fields directly from one set of values to another. It operates on a map of view IDs to renderer instances and animates field values over time. This makes it ideal for simple property animations where you know the renderer and fields to tween.
Key features:
- Animates one or many SG nodes at once using JSON maps
- Supports repeat and reverse
- Can start from current renderer values
- Fixed-step timing tuned for Roku performance
Core API (summary)
animateTo(values, duration, options?)
: Start/retarget with{ viewId: { field: value } }
maps.start(resume?, useCurrentState?)
: Begin; optionally sample current values.stop()
,pause()
,resume()
.
Live Example
Press Pulse to widen and flash the rectangle using reverse; press Blue to restore its color.
Pass useCurrentState: true
to avoid jumps when retargeting mid-animation.
animateTo(values, duration, options?)
: set new targets; canrepeat
andreverse
.start(resume?, useCurrentState?)
: begin or resume; optionally sample current values.stop()
,pause()
,resume()
.
Single-view convenience: ViewAnimator
If you want to animate a single renderer, use ViewAnimator
(a thin wrapper over ViewJsonAnimator
).
Sequence
Also note: BaseView.animateTo helper
At the view level, BaseView
exposes efficient renderer updates. For orchestrated, state-driven animations across many views, prefer HosannaViewAnimator.
Stop or retarget existing animations before launching new ones on the same view to avoid tug-of-war.