Skip to content

Instantly share code, notes, and snippets.

@xThuby
xThuby / Easy.jai
Created November 26, 2024 20:45
Simple easing collection for Jai
#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
@xThuby
xThuby / gist:03d1bc42140d8173e0655b8cc992f913
Created January 13, 2025 10:11
Jai approach/move_towards utils
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;