Playhead
fun Playhead(position: () -> Duration, scale: TimelineScale, modifier: Modifier = Modifier, scrollPx: () -> Float = { 0f }, sourceOffset: () -> Duration = { Duration.ZERO }, colors: TimelineColors = FilmstripTimelineDefaults.Palette, width: Dp = FilmstripTimelineDefaults.PlayheadWidth, knobSize: Dp = FilmstripTimelineDefaults.PlayheadKnobSize)(source)
The playhead line and its knob, drawn over the strip.
position and scrollPx are read while drawing rather than during composition, so a playhead ticking at ten frames a second costs a redraw and no recomposition. Hand it PlayheadState.positionProvider() rather than reading the position in a composable body.
Parameters
position
Where the playhead is.
scale
What turns that into content pixels.
modifier
Modifier for the playhead, which fills whatever it is placed in.
scrollPx
How far the timeline has scrolled, in content pixels.
sourceOffset
Where the player's zero sits on the timeline's clock, so timelineTime == playerTime + sourceOffset() .
colors
What the playhead paints with.
width
How wide the line is drawn.
knobSize
How wide the knob above the line is drawn.