FilmstripStrip
fun FilmstripStrip(frames: FilmstripFrames, grid: StripGrid, modifier: Modifier = Modifier, state: LazyListState = rememberLazyListState(), tileHeight: Dp = FilmstripTimelineDefaults.StripHeight, colors: TimelineColors = FilmstripTimelineDefaults.Palette, userScrollEnabled: Boolean = true, placeholder: @Composable (index: Int) -> Unit = { })(source)
The scrolling strip of tiles.
Reports its own window to frames as it scrolls, which is what keeps decoding to the tiles on screen and their overscan. The caller builds frames, and with it sets the byte cap and the overscan.
BoxWithConstraints {
val density = LocalDensity.current
val timeline = rememberTimelineState(
duration = sourceDuration,
viewportWidthPx = with(density) { maxWidth.toPx() },
tileWidthPx = with(density) { FilmstripTimelineDefaults.TileWidth.roundToPx() },
)
val frames = rememberFilmstripFrames(
renderer = filmstrip,
composition = composition,
positions = timeline.grid.positions,
heightPx = with(density) { FilmstripTimelineDefaults.StripHeight.roundToPx() },
)
Box(Modifier.height(FilmstripTimelineDefaults.StripHeight)) {
FilmstripStrip(frames = frames, grid = timeline.grid, state = timeline.listState)
Playhead(
position = playhead.positionProvider(),
scale = timeline.scale,
scrollPx = timeline::scrollPx,
)
}
}Content copied to clipboard
Parameters
frames
The decoded tiles, built over the same positions as grid.
grid
Where the tiles sit and how wide they are.
modifier
Modifier for the row.
state
The row's scroll state, which the ruler and the overlays read to stay aligned.
tileHeight
How tall the tiles are drawn.
colors
What the strip paints with.
userScrollEnabled
Whether a finger may scroll the row.
placeholder
What fills a tile whose frame has not arrived.