Back to Projects
TweenAvalonia
Programmatic tweens for Avalonia. Used in Xenia Manager Big Screen Mode for dashboard fades and background transitions.
Problem
Avalonia XAML Transitions cannot be stopped, completed or awaited and give no completion callback. For anything beyond a simple hover you end up writing timers or fighting the framework.
The goal was a small library that feels like PrimeTween: only target and end value required, sensible defaults, but every animation returns a handle you control. It is already used in Xenia Manager Big Screen Mode for fades and transitions.
Key Technical Decisions
- One shared ticker A single UI thread ticker drives every tween and sleeps while idle. No per animation timers and no setup call.
- Handles that cannot go stale Public Tween is a versioned struct over pooled instances. Stopping a tween releases it and bumps the version so old handles are harmless.
- Latest wins superseding A new tween on the same target and property stops the previous one. StopAll and CompleteAll work on the same table.
- Typed factories Factories for double, float, int, Color, Point, Vector, Thickness and Rect plus sugar for Opacity, Color, Margin, Width and Height. Unsupported types throw at creation.
- Zero allocation hot paths Pooled instances, struct awaiter, cached target based callbacks and no boxing on per frame writes. Guarded by allocation tests.
- Small ergonomic defaults Only target and end value required. Defaults to 1s and SineEaseInOut. TweenSettings bundles can be reused and DefaultEasing is settable.