1 line
5.4 KiB
JSON
1 line
5.4 KiB
JSON
{"ast":null,"code":"import { easeInOut, isEasingArray, easingDefinitionToFunction } from 'motion-utils';\nimport { interpolate } from '../../utils/interpolate.mjs';\nimport { defaultOffset } from '../keyframes/offsets/default.mjs';\nimport { convertOffsetToTimes } from '../keyframes/offsets/time.mjs';\nfunction defaultEasing(values, easing) {\n return values.map(() => easing || easeInOut).splice(0, values.length - 1);\n}\nfunction keyframes({\n duration = 300,\n keyframes: keyframeValues,\n times,\n ease = \"easeInOut\"\n}) {\n /**\n * Easing functions can be externally defined as strings. Here we convert them\n * into actual functions.\n */\n const easingFunctions = isEasingArray(ease) ? ease.map(easingDefinitionToFunction) : easingDefinitionToFunction(ease);\n /**\n * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator\n * to reduce GC during animation.\n */\n const state = {\n done: false,\n value: keyframeValues[0]\n };\n /**\n * Create a times array based on the provided 0-1 offsets\n */\n const absoluteTimes = convertOffsetToTimes(\n // Only use the provided offsets if they're the correct length\n // TODO Maybe we should warn here if there's a length mismatch\n times && times.length === keyframeValues.length ? times : defaultOffset(keyframeValues), duration);\n const mapTimeToKeyframe = interpolate(absoluteTimes, keyframeValues, {\n ease: Array.isArray(easingFunctions) ? easingFunctions : defaultEasing(keyframeValues, easingFunctions)\n });\n return {\n calculatedDuration: duration,\n next: t => {\n state.value = mapTimeToKeyframe(t);\n state.done = t >= duration;\n return state;\n }\n };\n}\nexport { defaultEasing, keyframes };","map":{"version":3,"names":["easeInOut","isEasingArray","easingDefinitionToFunction","interpolate","defaultOffset","convertOffsetToTimes","defaultEasing","values","easing","map","splice","length","keyframes","duration","keyframeValues","times","ease","easingFunctions","state","done","value","absoluteTimes","mapTimeToKeyframe","Array","isArray","calculatedDuration","next","t"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/motion-dom/dist/es/animation/generators/keyframes.mjs"],"sourcesContent":["import { easeInOut, isEasingArray, easingDefinitionToFunction } from 'motion-utils';\nimport { interpolate } from '../../utils/interpolate.mjs';\nimport { defaultOffset } from '../keyframes/offsets/default.mjs';\nimport { convertOffsetToTimes } from '../keyframes/offsets/time.mjs';\n\nfunction defaultEasing(values, easing) {\n return values.map(() => easing || easeInOut).splice(0, values.length - 1);\n}\nfunction keyframes({ duration = 300, keyframes: keyframeValues, times, ease = \"easeInOut\", }) {\n /**\n * Easing functions can be externally defined as strings. Here we convert them\n * into actual functions.\n */\n const easingFunctions = isEasingArray(ease)\n ? ease.map(easingDefinitionToFunction)\n : easingDefinitionToFunction(ease);\n /**\n * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator\n * to reduce GC during animation.\n */\n const state = {\n done: false,\n value: keyframeValues[0],\n };\n /**\n * Create a times array based on the provided 0-1 offsets\n */\n const absoluteTimes = convertOffsetToTimes(\n // Only use the provided offsets if they're the correct length\n // TODO Maybe we should warn here if there's a length mismatch\n times && times.length === keyframeValues.length\n ? times\n : defaultOffset(keyframeValues), duration);\n const mapTimeToKeyframe = interpolate(absoluteTimes, keyframeValues, {\n ease: Array.isArray(easingFunctions)\n ? easingFunctions\n : defaultEasing(keyframeValues, easingFunctions),\n });\n return {\n calculatedDuration: duration,\n next: (t) => {\n state.value = mapTimeToKeyframe(t);\n state.done = t >= duration;\n return state;\n },\n };\n}\n\nexport { defaultEasing, keyframes };\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,aAAa,EAAEC,0BAA0B,QAAQ,cAAc;AACnF,SAASC,WAAW,QAAQ,6BAA6B;AACzD,SAASC,aAAa,QAAQ,kCAAkC;AAChE,SAASC,oBAAoB,QAAQ,+BAA+B;AAEpE,SAASC,aAAaA,CAACC,MAAM,EAAEC,MAAM,EAAE;EACnC,OAAOD,MAAM,CAACE,GAAG,CAAC,MAAMD,MAAM,IAAIR,SAAS,CAAC,CAACU,MAAM,CAAC,CAAC,EAAEH,MAAM,CAACI,MAAM,GAAG,CAAC,CAAC;AAC7E;AACA,SAASC,SAASA,CAAC;EAAEC,QAAQ,GAAG,G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