TimelineScale
The mapping between composition time and content pixels at one zoom level.
The ruler, the tiles, the playhead and the trim handles all read their geometry from this, so a strip that scrolls cannot drift out of agreement with what is drawn over it.
Content pixels run from zero at the start of the composition to contentWidthPx at its end, which is wider than the viewport at any zoom the whole strip does not fit in. Subtract the scroll offset to reach viewport pixels.
val scale = TimelineZoom.fitting(duration, viewportWidthPx).scaleFor(duration)
Canvas(Modifier.fillMaxSize()) {
val x = scale.xOf(marker) - scrollPx()
if (x in 0f..size.width) {
drawLine(color, Offset(x, 0f), Offset(x, size.height))
}
}Content copied to clipboard
Properties
Functions
Link copied to clipboard
How far apart ruler ticks should sit, as the smallest step from TICKS that draws at least minSpacingPx apart.
Link copied to clipboard
The same zoom over duration.
Link copied to clipboard
The same timeline drawn at pixelsPerSecond.