Auto commit (MindMachine) Sat Apr 11 12:01:03 PM CDT 2026
This commit is contained in:
@@ -812,14 +812,25 @@ private fun rememberSplitFlashFrame(
|
||||
return@produceState
|
||||
}
|
||||
|
||||
// Lock the sequencer's time base to Compose's frame clock.
|
||||
// Mixing System.nanoTime() (start) with withFrameNanos() (updates) can introduce
|
||||
// an arbitrary offset that looks like irregular intervals.
|
||||
val sequencer = SplitFlashSequencer(
|
||||
startTimeNanos = System.nanoTime(),
|
||||
startTimeNanos = 0L,
|
||||
flashOnMs = latestFlashOnMs.value,
|
||||
flashOffMs = latestFlashOffMs.value,
|
||||
)
|
||||
|
||||
var started = false
|
||||
|
||||
while (true) {
|
||||
withFrameNanos { frameTimeNanos ->
|
||||
if (!started) {
|
||||
// Initialize phaseStartNanos to the first real frame timestamp.
|
||||
// This keeps phase transitions aligned to the same monotonic clock.
|
||||
sequencer.frameAt(frameTimeNanos)
|
||||
started = true
|
||||
}
|
||||
sequencer.updateIntervals(latestFlashOnMs.value, latestFlashOffMs.value)
|
||||
value = sequencer.frameAt(frameTimeNanos)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user