The library defines several custom easing functions that drive the character-level animations produced whenDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/6xingyv/accompanist-lyrics-ui/llms.txt
Use this file to discover all available pages before exploring further.
useAwesomeAnimation = true. These easings are applied frame-by-frame inside KaraokeLineText’s canvas draw loop to translate a linear [0, 1] playhead position into expressive animation curves for translation, scale, and glow effects.
NewtonPolynomialInterpolationEasing
NewtonPolynomialInterpolationEasing is a custom implementation of Compose’s Easing interface that fits a polynomial through an arbitrary set of (x, y) control points using Newton’s divided difference method and evaluates it efficiently with Horner’s method.
Unlike CubicBezierEasing, which is limited to a single cubic segment, this class lets you define multi-point curves with arbitrary shape — including curves that dip below zero or rise above one.
A list of
(x, y) control points through which the polynomial is interpolated. All x values must be unique. The first point should typically be (0.0, 0.0) and the last (1.0, targetValue) to match the [0, 1] fraction range used by Compose animation.transform
fraction using Horner’s method. The divided difference coefficients are pre-computed in init, so this method is O(n) in the number of control points with no allocations.
Because the polynomial can pass through any set of points, it may produce values outside
[0, 1]. This is intentional for animations like DipAndRise (negative values move a character downward) and Swell (values above 1.0 momentarily enlarge a character beyond its rest size).Custom easing example
Pre-defined easings
DipAndRise
A character dips downward before rising to its final position, creating the floating/rising effect you see as each character in a long syllable is sung.(0.0, 0.0) → (0.5, -dip) → (1.0, rise)
The default rise = 1.0 means the character ends at its normal position. A higher value keeps the character raised, while a higher dip makes the initial downward motion more pronounced.
Applied to: vertical translation (Y offset) of each character during its timing window.
Swell
A character briefly scales above its rest size at the midpoint of its animation window, then returns to normal — a subtle pulse that gives each character a sense of weight.(0.0, 0.0) → (0.5, swell) → (1.0, 0.0)
The default swell = 0.1 adds 10 % to the character’s scale at the peak. Keep this value small — large values look jarring at typical lyric font sizes.
Applied to: scale of each character, composited on top of the word-level scale transform.
Bounce
A glow or shadow intensity that peaks at 70 % progress then fades back to zero, producing a light-burst effect at the moment each character is fully highlighted.(0.0, 0.0) → (0.7, 1.0) → (1.0, 0.0)
Applied to: shadow blur radius (glow intensity) drawn beneath each character.
EasingOutCubic
A standard ease-out cubic curve used for the simpler floating animation applied to whole words whenuseAwesomeAnimation = false.
CubicBezierEasing with control points chosen to match the CSS ease-out-cubic specification. It produces a fast initial motion that decelerates smoothly to rest.
Applied to: vertical translation of the word-level float animation.
Summary table
| Name | Control points | Effect | Applied to |
|---|---|---|---|
DipAndRise | (0,0) → (0.5,−dip) → (1,rise) | Dip then rise | Character Y offset |
Swell | (0,0) → (0.5,swell) → (1,0) | Scale pulse | Character scale |
Bounce | (0,0) → (0.7,1) → (1,0) | Light burst | Shadow blur radius |
EasingOutCubic | Cubic Bézier (0.33, 1, 0.68, 1) | Fast-then-slow | Word Y offset |
These easings are used internally by the animation system and you typically do not need to interact with them directly. They are exposed publicly so that you can pass custom instances when overriding the animation parameters — for example, to flatten
DipAndRise for a less bouncy feel: