Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save patrickmatte/7c882a61f75d537f76d0f7968515d497 to your computer and use it in GitHub Desktop.
Save patrickmatte/7c882a61f75d537f76d0f7968515d497 to your computer and use it in GitHub Desktop.
Spring formula
// Ease out
value = value + (targetValue - value) / friction;
// Elastic
speed = speed * elasticity + (targetValue - value) / friction;
value = value + speed;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment