/
githubmirror
/
anime
Обзор
Документация
Войти
/
githubmirror
/
anime
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/easings/steps/index.js
23 строки
548 B
Julian Garnier
v4.2.0
29 сен 2025, 17:54
29 сен 2025, 17:54
00106be
Код
Авторство
О чём код?
import { ceil, clamp, floor, } from "../../core/helpers.js"; /** * @import { * EasingFunction, * } from '../../types/index.js' */ /** * Steps ease implementation https://developer.mozilla.org/fr/docs/Web/CSS/transition-timing-function * Only covers 'end' and 'start' jumpterms * @param {Number} steps * @param {Boolean} [fromStart] * @return {EasingFunction} */ export const steps = (steps = 10, fromStart) => { const roundMethod = fromStart ? ceil : floor; return t => roundMethod(clamp(t, 0, 1) * steps) * (1 / steps); }