Kaanixir
05/26/2026, 12:25 PMrememberInfiniteTransition + animateFloat to drive a radial/glow Canvas effect made the whole page lag: trackpad scroll, tab switching, and tab morph animations all became delayed, very, very laggy
Proof:
- attached vid
- Compose animated dot enabled -> scroll/tabs very laggy
- Same dot made static or moved to DOM/CSS overlay -> smooth
val transition = rememberInfiniteTransition(label = "status-dot")
val glow by transition.animateFloat(
0f,
1f,
infiniteRepeatable(
animation = tween(3600, easing = FastOutSlowInEasing),
repeatMode = RepeatMode.Reverse,
),
)
The infinite Compose animation seems to keep invalidating the frame path. Since the app is effectively one rendered surface, the glow is not isolated like a browser
compositor layer, so it competes with scroll and other animations.
Q:
1. Is this expected for Compose/Wasm today?
2. Can continuous animations be isolated from whole-scene redraw?
3. Are Canvas/radial glow/shadow effects especially expensive on Wasm? how expensive could it be lol
4. Do we need an optimisation in Skiko/Skia/WebGL? Or is DOM/CSS interop currently the practical path for compositor-friendly decorative animations on web?
Refs:
- Compose-side reference:
https://github.com/sdfgsdfgd/backend/blob/main/dashboard/src/commonMain/kotlin/net/sdfgsdfg/dashboard/DashboardApp.kt#L1438-L1554
- Wasm DOM bridge:
https://github.com/sdfgsdfgd/backend/blob/main/dashboard/src/wasmJsMain/kotlin/net/sdfgsdfg/dashboard/PlatformStatusDot.wasmJs.kt#L32-L88
- CSS animation:
https://github.com/sdfgsdfgd/backend/blob/main/dashboard/web/src/wasmJsMain/resources/styles.css#L24-L141
Attached
vid1: recorded with compose animations enabled
vid2: recorded with compose anims disabled, replaced by CSS animationsRey (Kingg22)
05/26/2026, 1:42 PMKaanixir
05/26/2026, 1:57 PMKaanixir
05/26/2026, 2:17 PMWinson Chiu
05/26/2026, 4:06 PMKaanixir
05/27/2026, 5:38 PMCanvas { ... } draw lambda, where it affects draw parameters like gradient alpha/radius. It is not used to build layout/modifiers/content, so this should already be a draw-phase read.
So it has nothing to do with proper implementation of compose or animations IMOWinson Chiu
05/27/2026, 5:43 PMrememberInfiniteTransition call. Yeah, the Canvas one looks correct, it must be Wasm related.Kaanixir
06/08/2026, 4:38 AM