Anime.js provides a comprehensive set of utility functions for mathematical operations, value manipulation, and functional composition. These utilities support chainable operations for elegant function composition.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/juliangarnier/anime/llms.txt
Use this file to discover all available pages before exploring further.
Random Utilities
random()
Generates a random number between min and max (inclusive) with optional decimal precision.The minimum value (inclusive)
The maximum value (inclusive)
Number of decimal places to round to
createSeededRandom()
Creates a seeded pseudorandom number generator function for reproducible randomness.The seed value for the random number generator
Default minimum value for the returned function
Default maximum value for the returned function
Default number of decimal places for the returned function
randomPick()
Picks a random element from an array or a random character from a string.The array or string to pick from
shuffle()
Shuffles an array in-place using the Fisher-Yates algorithm.The array to shuffle (modified in-place)
Mathematical Utilities
clamp()
Clamps a value between minimum and maximum bounds.Value to clamp
Minimum boundary
Maximum boundary
round()
Rounds a number to specified decimal places.Value to round
Number of decimal places
snap()
Snaps a value to the nearest increment or closest array value.Value to snap
Step size or array of snap points
wrap()
Wraps a value within a range (circular wrapping).Value to wrap
Minimum boundary
Maximum boundary
lerp()
Linear interpolation between two values.Starting value
Ending value
Interpolation factor in the range [0, 1]
damp()
Frame rate independent damped linear interpolation.Starting value
Target value
Delta time in milliseconds
Interpolation factor in the range [0, 1]
mapRange()
Maps a value from one range to another.Input value
Input range minimum
Input range maximum
Output range minimum
Output range maximum
degToRad()
Converts degrees to radians.Angle in degrees
radToDeg()
Converts radians to degrees.Angle in radians
String Utilities
roundPad()
Rounds a number to fixed decimal places and returns as string.Value to round
Number of decimal places
padStart()
Pads the start of a value with a string.Value to pad
Target length
String to pad with
padEnd()
Pads the end of a value with a string.Value to pad
Target length
String to pad with
Chainable Utilities
All mathematical utilities support chainable operations for elegant function composition:clamp(min, max)round(decimalLength)snap(increment)wrap(min, max)lerp(start, end)damp(start, end, deltaTime)mapRange(inLow, inHigh, outLow, outHigh)roundPad(decimalLength)padStart(totalLength, padString)padEnd(totalLength, padString)degToRad()radToDeg()