Skip to content

Instantly share code, notes, and snippets.

@harpwood
Created September 14, 2020 07:46
Show Gist options
  • Save harpwood/8527de8c13cce174a989c1c1c8f64340 to your computer and use it in GitHub Desktop.
Save harpwood/8527de8c13cce174a989c1c1c8f64340 to your computer and use it in GitHub Desktop.
Move target to endpoint by given amount
/// @func approach(target, endpoint, amount);
/// @description move target to endpoint by given amount
/// @arg target
/// @arg endpoint
/// @arg amount
if(argument0 < argument1) return min(argument0 + argument2, argument1);
else return max(argument0 - argument2, argument1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment