KiteAnimatedImage

@Composable
fun KiteAnimatedImage(animation: KiteAnimation, contentDescription: String?, modifier: Modifier = Modifier, alignment: Alignment = Alignment.Center, contentScale: ContentScale = ContentScale.Fit, alpha: Float = DefaultAlpha, colorFilter: ColorFilter? = null, filterQuality: FilterQuality = DrawScope.DefaultFilterQuality, animate: Boolean = true)(source)

Play an already-decoded KiteAnimation: the one frame loop shared by KiteImage's byte-array overload and imagekodec-coil's KiteAsyncImage. Public because callers running their own decode pipeline deserve playback too, exactly like the KiteImage overload that takes a KiteBitmap.

The frame to show is derived from elapsed frame-clock time against the animation's cumulative delays (not chained delay() calls), so scheduling latency never accumulates: playback can't drift slow over long loops, and a janky UI skips frames like every browser does instead of slowing the GIF down. Honors per-frame delays, the NETSCAPE loop count (0 = forever), and holds the last frame once a finite loop completes.

Frames convert to ImageBitmap on Dispatchers.Default, in order and ahead of playback, once each per animation instance, so the thread that draws never pays for the copy. Only a first frame of at most 65,536 pixels converts at once, where that costs less than drawing nothing would; a larger one leaves the slot empty, at the frame's size, until it is ready, and the clock starts when it shows. Should a frame come due before its conversion ends, the newest converted frame stays up, as a browser does when decoding falls behind. Static (single-frame) animations just draw. animate pins the first frame when false (thumbnails, previews), and then only that frame converts.