Smooth slowing down of spinning speed using a script?
Hey guys,
I'm trying to write a script for one of my wallpapers' spinning animations. I want to slow down the spinning smoothly when sound gets quiet. I tried to decrease the spinning animation on each update by about 0.01. But this doesn't really work and causes the spin to go into the other direction.
Here is my code to decrease the spinning when the music gets quiet:
if (Math.abs(smoothAudioVolume) > 0.1) {
return defaultSpeed
} else {
if (value - 0.01 > 0) {
return value - 0.001
} else {
return 0
}
}