Adjust squiggly track

This commit is contained in:
Sad Ellie 2023-05-23 10:07:00 +03:00
parent 4c727718b8
commit 71c89d9062

View File

@ -78,14 +78,14 @@ private fun SquigglyTrack(
unfilledColor: Color = MaterialTheme.colorScheme.surfaceVariant unfilledColor: Color = MaterialTheme.colorScheme.surfaceVariant
) { ) {
val coroutineScope = rememberCoroutineScope() val coroutineScope = rememberCoroutineScope()
var direct by remember { mutableStateOf(1f) } var direct by remember { mutableStateOf(0.72f) }
val animatedDirect = animateFloatAsState(direct, spring()) val animatedDirect = animateFloatAsState(direct, spring())
val slider = sliderPosition.activeRange.endInclusive val slider = sliderPosition.activeRange.endInclusive
LaunchedEffect(sliderPosition.activeRange.endInclusive) { LaunchedEffect(sliderPosition.activeRange.endInclusive) {
coroutineScope.launch { coroutineScope.launch {
delay(300L) delay(200L)
direct = if (direct == 1f) -1f else 1f direct *= -1
} }
} }
@ -110,7 +110,7 @@ private fun SquigglyTrack(
relativeQuadraticBezierTo( relativeQuadraticBezierTo(
dx1 = eachWaveWidth * 0.5f, dx1 = eachWaveWidth * 0.5f,
// 0.75, because 1.0 was clipping out of bound for some reason // 0.75, because 1.0 was clipping out of bound for some reason
dy1 = height.times(0.75f) * peek, dy1 = height.times(peek),
dx2 = eachWaveWidth, dx2 = eachWaveWidth,
dy2 = 0f dy2 = 0f
) )