1 line
32 KiB
JSON
1 line
32 KiB
JSON
|
|
{"ast":null,"code":"import _objectSpread from \"/Users/apple/Documents/cursor/Web\\u8BFE\\u4EF6/AI\\u8BFE/education_web_\\u591AAgent\\u534F\\u4F5C\\u7CFB\\u7EDF/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";\nimport _objectWithoutProperties from \"/Users/apple/Documents/cursor/Web\\u8BFE\\u4EF6/AI\\u8BFE/education_web_\\u591AAgent\\u534F\\u4F5C\\u7CFB\\u7EDF/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js\";\nconst _excluded = [\"defaultTransition\"],\n _excluded2 = [\"delay\", \"times\", \"type\", \"repeat\", \"repeatType\", \"repeatDelay\"];\nimport { isMotionValue, defaultOffset, isGenerator, createGeneratorEasing, fillOffset } from 'motion-dom';\nimport { progress, secondsToMilliseconds, invariant, getEasingForSegment } from 'motion-utils';\nimport { resolveSubjects } from '../animate/resolve-subjects.mjs';\nimport { calculateRepeatDuration } from './utils/calc-repeat-duration.mjs';\nimport { calcNextTime } from './utils/calc-time.mjs';\nimport { addKeyframes } from './utils/edit.mjs';\nimport { normalizeTimes } from './utils/normalize-times.mjs';\nimport { compareByTime } from './utils/sort.mjs';\nconst defaultSegmentEasing = \"easeInOut\";\nconst MAX_REPEAT = 20;\nfunction createAnimationsFromSequence(sequence) {\n let _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n {\n defaultTransition = {}\n } = _ref,\n sequenceTransition = _objectWithoutProperties(_ref, _excluded);\n let scope = arguments.length > 2 ? arguments[2] : undefined;\n let generators = arguments.length > 3 ? arguments[3] : undefined;\n const defaultDuration = defaultTransition.duration || 0.3;\n const animationDefinitions = new Map();\n const sequences = new Map();\n const elementCache = {};\n const timeLabels = new Map();\n let prevTime = 0;\n let currentTime = 0;\n let totalDuration = 0;\n /**\n * Build the timeline by mapping over the sequence array and converting\n * the definitions into keyframes and offsets with absolute time values.\n * These will later get converted into relative offsets in a second pass.\n */\n for (let i = 0; i < sequence.length; i++) {\n const segment = sequence[i];\n /**\n * If this is a timeline label, mark it and skip the rest of this iteration.\n */\n if (typeof segment === \"string\") {\n timeLabels.set(segment, currentTime);\n continue;\n } else if (!Array.isArray(segment)) {\n timeLabels.set(segment.name, calcNextTime(currentTime, segment.at, prevTime, timeLabels));\n continue;\n }\n let [subject, keyframes, transition = {}] = segment;\n /**\n * If a relative or absolute time value has been specified we need to resolve\n * it in relation to the currentTime.\n */\n if (transition.at !== undefined) {\n currentTime = calcNextTime(currentTime, transition.at, prevTime, timeLabels);\n }\n /**\n * Keep track of the maximum duration in this definition. This will be\n * applied to currentTime once the definition has been parsed.\n */\n let maxDuration = 0;\n const resolveValueSequence = function (valueKeyframes, valueTransition, valueSequence) {\n let elementIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n let numSubjects = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;\n const valueKeyframesAsList = keyframesAsList(valueKeyframes);\n const {\n delay = 0,\n times = defaultOffset(valueKeyframesAsList),\n type = \"keyframes\",\n repeat,\n repeatType,\n repeatDelay = 0\n } = valueTransition,\n remainingTransition = _objectWithoutProperties(valueTransition, _excluded2);\n let {\n ease = defaultTransition.ease || \"easeOut\",\n duration\n } = valueTransition;\n /**\n * Resolve stagger() if defined.\n */\n const calculatedDelay = typeof delay === \"function\" ? delay(elementIndex, numSubjects) : delay;\n /**\n * If this animation should and ca
|