This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "Basic"; | |
#import "Math"; | |
/* | |
A collection of very handy easing functions. | |
Made the names more sensible and ported to The Language (Jai) by @xThuby | |
Original C# source: https://gist.github.com/Fonserbc/3d31a25e87fdaa541ddf | |
*/ | |
#scope_file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
approach :: (from: float, target: float, max_delta: float) -> float { | |
if from > target then return max(from - max_delta, target); | |
return min(from + max_delta, target); | |
} | |
approach :: (from: *float, target: float, max_delta: float) { | |
if from.* > target { | |
from.* = max(from.* - max_delta, target); | |
return; |