INNER CODE UNIT · Kotlin
targetAmplitude
Ayush0Chaudhary/blurr · app/src/main/java/com/blurr/voice/AudioWaveView.kt:111
val targetAmplitude = minIdleAmplitude + (scaledAmplitude * maxWaveHeightScale)
amplitudeAnimator?.cancel()
amplitudeAnimator = ValueAnimator.ofFloat(audioAmplitude, targetAmplitude).apply {
duration = realtimeAmplitudeTransitionDuration // Use short duration for responsiveness
interpolator = AccelerateDecelerateInterpolator()
addUpdateListener { animation ->
audioAmplitude = animation.animatedValue as Float
}
start()
}
}
/**
* Smoothly animates the wave's amplitude to a new target level.
* Used for non-realtime effects like a "power up" sequence.
* @param target The target amplitude level (0.0f for idle, 1.0f for full).
*/
fun setTargetAmplitude(target: Float) {