Parameters
Name | Type | Description |
---|---|---|
t | f32 | Input parameter (0-1). |
Returns
f32value with elastic effect.
WGSL Code
fn elasticIn(t: f32) -> f32 {let tt = clamp(t, 0.0, 1.0);return sin(13.0 * 3.14159 * tt) * pow(2.0, 10.0 * (tt - 1.0));}
Name | Type | Description |
---|---|---|
t | f32 | Input parameter (0-1). |
fn elasticIn(t: f32) -> f32 {let tt = clamp(t, 0.0, 1.0);return sin(13.0 * 3.14159 * tt) * pow(2.0, 10.0 * (tt - 1.0));}
a cubic Bezier curve and returns both value and derivative.
ease-in function for smooth acceleration.
ease-out function for smooth deceleration.
ease-in-out function for smooth acceleration and deceleration.
ease-out function with oscillating motion.
ease-in function that overshoots before settling.
ease-out function that overshoots before settling.
spring animation with configurable parameters.
A JavaScript library providing WGSL utility functions as strings for WebGPU shader development. Includes mathematical utilities, noise generation, signed distance fields, and color manipulation functions.
npm install wgsl-fns
import { elasticIn, getFns } from 'wgsl-fns'
getFns(['elasticIn'])