How do you keep animations smooth and avoid jank?
Short answer
Animate transform properties (Translation, Scale, Rotation, Opacity) which are cheap, rather than layout-affecting properties that trigger re-measure. Keep per-frame callbacks lightweight, avoid allocations in loops, and prefer GPU-friendly transforms.
Advertisement
AModel answer
Animate transform properties (Translation, Scale, Rotation, Opacity) which are cheap, rather than layout-affecting properties that trigger re-measure. Keep per-frame callbacks lightweight, avoid allocations in loops, and prefer GPU-friendly transforms. Test on low-end devices where jank appears first.
// Cheap: transform-only
await card.TranslateTo(0, -20, 150, Easing.SinOut);
// Costly: animating HeightRequest forces layout each frameReal-world example
Replacing a height animation with a translate transform removes stutter on budget Android phones.
Likely follow-ups
- Why avoid animating layout properties? | Which properties are GPU-friendly?
Related topics