You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Animate a text's number (count-up): no way to bind text content to an AnimatedValue #336
A common motion in a dashboard is a figure that counts up to its new value: "18.7 GB can be freed" rolling from the old number to the new one when a check ends. NSGo has a rich animation graph (AnimatedValue, Timing, Spring, Interpolate, Motion), but nothing animated can reach a text's content:
AnimatedStyle (core/animated.go:158) binds opacity, transforms, colors, shadows and StickyInset, but not text.
AnimatedValue offers only a one-shot Read(cx, fn) (core/animated.go:71); there is no listener that reports the value as it moves.
The remaining route is a RequestAnimationFrame loop that sets a signal every frame and formats the number in Go. That works in the app, but nsgotest steps never wait for it: App.done (nsgotest/nsgotest.go:484) only advances while a.anim.Ending() || a.tree.Pacing(), and frames the app asks for itself are documented not to hold a step. So a test that checks the figure after a step reads whatever frame the loop reached, usually the start value.
Why it matters
Apps either skip the effect or ship code whose final state their headless tests cannot reach without hand-moving the clock in every test that reads the figure.
Proposal
Either of these would do; the first is closer to the existing graph:
A text binding in AnimatedStyle, or a core.AnimatedText{Value: AnimatedNode, Format: NumberFormat} node, where NumberFormat is data the platform can apply each frame: decimals, prefix and suffix, and optionally a unit ladder (for example 1000-based steps with "B", "KB", "MB", "GB") so byte sizes can count up without Go running per frame.
A tween driven by the animator's clock that calls back into Go, for example cx.Tween(from, to float64, TimingConfig, func(v float64)), which counts as an animation that ends for nsgotest (anim.Ending()), lands at to at once under reduced motion, and stops with its scope.
Acceptance
A figure can animate from one number to another without the app running its own frame loop.
After a step that starts it, nsgotest shows the final value (the step waits for it like any other animation that ends).
Implemented in PR #1001. Scope.Tween drives a Go callback from the animation clock, keeps finite tweens in nsgotest's settling loop, stops with the animation owner, and resolves to the final value immediately under reduced motion. Focused tests cover final-step settling and reduced motion, and the animation guides document the text-binding use case.
Activity
houko commentedon Nov 20, 2026
Implemented in PR #1001.
Scope.Tweendrives a Go callback from the animation clock, keeps finite tweens in nsgotest's settling loop, stops with the animation owner, and resolves to the final value immediately under reduced motion. Focused tests cover final-step settling and reduced motion, and the animation guides document the text-binding use case.PR: #1001