motion-dom
Version:
31 lines (28 loc) • 1.08 kB
JavaScript
import { complex } from '../complex/index.mjs';
import { filter } from '../complex/filter.mjs';
import { mask } from '../complex/mask.mjs';
import { getDefaultValueType } from '../maps/defaults.mjs';
const customTypes = /*@__PURE__*/ new Set([filter, mask]);
/**
* The last call and its result. animate() on many elements asks for the
* same none for each one, and parsing the value is the slow part.
*/
let lastKey;
let lastValue;
let lastNone;
function getAnimatableNone(key, value) {
if (key === lastKey && value === lastValue)
return lastNone;
let defaultValueType = getDefaultValueType(key);
if (!customTypes.has(defaultValueType))
defaultValueType = complex;
// If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
lastNone = defaultValueType.getAnimatableNone
? defaultValueType.getAnimatableNone(value)
: undefined;
lastKey = key;
lastValue = value;
return lastNone;
}
export { getAnimatableNone };
//# sourceMappingURL=animatable-none.mjs.map