MathUtils
NamespaceNamespace in the Lens Scripting API.
- Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.
Variables
| Variable | Description |
|---|---|
| DegToRad | Constant mapping degrees to radians. This equals pi/180. |
| RadToDeg | Constant mapping radians to degrees. This equals 180/pi. |
Functions
| Function | Description |
|---|---|
| clamp | Clamp floating-point value v in the range [lo, hi] (inclusive). |
| lerp | Linearly interpolate from floating-point a to b, based on fraction t (where t=0.0 returns a, and t=1.0 returns b). This is equivalent to the vec2 and vec3 lerp() functions, but operates on scalar floating-point values. |
| randomRange | Generate a random floating-point value in the range [lo, hi). Note, the range is inclusive at the lower end, and exclusive at the upper. |
| remap | Map floating-point v from range [inMin, inMax] to [outMin, outMax]. |