mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-18 23:05:26 +02:00
ui: Make RealtimeAudioVisualizer overflow
This commit is contained in:
parent
d8f36003ff
commit
d6d8125a38
@ -65,7 +65,8 @@ fun RealtimeAudioVisualizer(
|
|||||||
val screenWidth = with (LocalDensity.current) {configuration.screenWidthDp.dp.toPx()}
|
val screenWidth = with (LocalDensity.current) {configuration.screenWidthDp.dp.toPx()}
|
||||||
|
|
||||||
LaunchedEffect(screenWidth) {
|
LaunchedEffect(screenWidth) {
|
||||||
service.maxAmplitudes = ceil(screenWidth.toInt() / BOX_DIFF).toInt()
|
// Add 1 to allow the visualizer to overflow the screen
|
||||||
|
service.maxAmplitudes = ceil(screenWidth.toInt() / BOX_DIFF).toInt() + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
Canvas(
|
Canvas(
|
||||||
@ -76,7 +77,7 @@ fun RealtimeAudioVisualizer(
|
|||||||
val height = this.size.height / 2f
|
val height = this.size.height / 2f
|
||||||
val width = this.size.width
|
val width = this.size.width
|
||||||
|
|
||||||
translate(width, height) {
|
translate(width + BOX_DIFF, height) {
|
||||||
translate(-animationProgress.value * (BOX_WIDTH + BOX_GAP), 0f) {
|
translate(-animationProgress.value * (BOX_WIDTH + BOX_GAP), 0f) {
|
||||||
amplitudes.forEachIndexed { index, amplitude ->
|
amplitudes.forEachIndexed { index, amplitude ->
|
||||||
val offset = amplitudes.size - index
|
val offset = amplitudes.size - index
|
||||||
|
Loading…
x
Reference in New Issue
Block a user