Skip to content

Instantly share code, notes, and snippets.

@JanikHelbig
Last active July 6, 2025 18:14
Show Gist options
  • Select an option

  • Save JanikHelbig/bc019a91e785fb98abcf32bbcb8f03d9 to your computer and use it in GitHub Desktop.

Select an option

Save JanikHelbig/bc019a91e785fb98abcf32bbcb8f03d9 to your computer and use it in GitHub Desktop.
Taken from a talk by Freya Holmér: https://www.youtube.com/watch?v=LSNQuFEDOyQ
// Also known as lerp smoothing.
public float ExpDecay(float a, float b, float decay, float deltaTime)
{
return b + (a - b) * exp(-decay * deltaTime);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment