dazza5000
02/28/2024, 10:06 PMdazza5000
02/28/2024, 10:06 PMval angle: Float by animateFloatAsState(
targetValue = if (animationRunning)
finalAngle
else 0f,
animationSpec = tween(durationMillis = SPIN_DURATION.toInt()),
label = "AnimateWheel",
)
LaunchedEffect(angle) {
}
dazza5000
02/28/2024, 10:07 PMdazza5000
02/28/2024, 10:09 PMdazza5000
02/28/2024, 10:09 PMdazza5000
02/28/2024, 10:10 PMStylianos Gakis
02/28/2024, 10:11 PMdazza5000
02/28/2024, 10:18 PMdazza5000
02/28/2024, 10:18 PMif (newAngle > nextVibrationAngle) {
nextVibrationAngle += sliceAngle
future?.cancel(true)
future = executor.submit {
context?.let { VibrationCompat.vibrate(it, EffectType.WHEEL_TICK) }
}
}
dazza5000
02/28/2024, 10:19 PMLaunchedEffect(angle) {
if (angle > nextVibrationAngle) {
nextVibrationAngle += sliceAngle
job?.cancel()
job = launch {
context.let { VibrationCompat.vibrate(it, EffectType.WHEEL_TICK) }
}
Log.d("WheelViewCompose", "Vibrating! $nextVibrationAngle")
}
}
dazza5000
02/28/2024, 10:19 PMdazza5000
02/28/2024, 10:44 PMdazza5000
02/28/2024, 10:44 PMBen Trengrove [G]
02/28/2024, 10:46 PMangle
as a keyBen Trengrove [G]
02/28/2024, 10:48 PMBen Trengrove [G]
02/28/2024, 10:50 PManimationRunning
as your keyBen Trengrove [G]
02/28/2024, 10:56 PMLaunchedEffect(animationRunning) {
if (animationRunning) {
snapshotFlow { angle }.collect { angle ->
// use angle
}
}
}
dazza5000
02/28/2024, 11:44 PMdazza5000
02/29/2024, 1:42 PM