: animation.ayaan — common visual animation helpers
:
: Each takes the current frame number and parameters, returns the value
: in `result`. Use them to drive Y offsets, scales, alphas, etc.

: Sine bob in [-amp, +amp]. frame and speed are floats.
func bob frame speed amp
    set result = {sin(frame * speed) * amp}
endfunc

: Pulse in [base, base+amp]. Same as bob but always positive.
func pulse frame speed base amp
    set s = {sin(frame * speed) * 0.5 + 0.5}
    set result = {base + amp * s}
endfunc

: Wobble: combines two sines for organic motion. Returns value in [-amp, +amp].
func wobble frame speed amp
    set s1 = {sin(frame * speed)}
    set s2 = {sin(frame * speed * 1.7 + 1.0)}
    set result = {(s1 * 0.6 + s2 * 0.4) * amp}
endfunc

: Screen-shake offset. Use to add to camera position when player gets hit.
: intensity is the max pixel offset. Returns a random value in [-intensity, +intensity].
func shake intensity
    rand n -1000 1000
    set result = {n * intensity / 1000}
endfunc

: Linear interpolation from a to b by t. Standard helper.
func gt_lerp a b t
    set result = {a + (b - a) * t}
endfunc

: Pulsing color brightness factor in [base, 1.0]. Use to multiply RGB.
func brightness_pulse frame speed base
    set s = {sin(frame * speed) * 0.5 + 0.5}
    set result = {base + (1 - base) * s}
endfunc
