Files
ai-course/node_modules/.cache/babel-loader/646bc796c94eff0bf2766df238d4701af0fd9fe871b5aa928f1e5f153035d68f.json

1 line
20 KiB
JSON
Raw Normal View History

{"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 = [\"autoplay\", \"delay\", \"type\", \"repeat\", \"repeatDelay\", \"repeatType\", \"keyframes\", \"name\", \"motionValue\", \"element\"];\nimport { MotionGlobalConfig, noop } from 'motion-utils';\nimport { time } from '../frameloop/sync-time.mjs';\nimport { JSAnimation } from './JSAnimation.mjs';\nimport { getFinalKeyframe } from './keyframes/get-final.mjs';\nimport { KeyframeResolver, flushKeyframeResolvers } from './keyframes/KeyframesResolver.mjs';\nimport { NativeAnimationExtended } from './NativeAnimationExtended.mjs';\nimport { canAnimate } from './utils/can-animate.mjs';\nimport { WithPromise } from './utils/WithPromise.mjs';\nimport { supportsBrowserAnimation } from './waapi/supports/waapi.mjs';\n\n/**\n * Maximum time allowed between an animation being created and it being\n * resolved for us to use the latter as the start time.\n *\n * This is to ensure that while we prefer to \"start\" an animation as soon\n * as it's triggered, we also want to avoid a visual jump if there's a big delay\n * between these two moments.\n */\nconst MAX_RESOLVE_DELAY = 40;\nclass AsyncMotionValueAnimation extends WithPromise {\n constructor(_ref) {\n var _this$keyframeResolve2;\n let {\n autoplay = true,\n delay = 0,\n type = \"keyframes\",\n repeat = 0,\n repeatDelay = 0,\n repeatType = \"loop\",\n keyframes,\n name,\n motionValue,\n element\n } = _ref,\n options = _objectWithoutProperties(_ref, _excluded);\n super();\n /**\n * Bound to support return animation.stop pattern\n */\n this.stop = () => {\n var _this$keyframeResolve;\n if (this._animation) {\n var _this$stopTimeline;\n this._animation.stop();\n (_this$stopTimeline = this.stopTimeline) === null || _this$stopTimeline === void 0 || _this$stopTimeline.call(this);\n }\n (_this$keyframeResolve = this.keyframeResolver) === null || _this$keyframeResolve === void 0 || _this$keyframeResolve.cancel();\n };\n this.createdAt = time.now();\n const optionsWithDefaults = _objectSpread({\n autoplay,\n delay,\n type,\n repeat,\n repeatDelay,\n repeatType,\n name,\n motionValue,\n element\n }, options);\n const KeyframeResolver$1 = (element === null || element === void 0 ? void 0 : element.KeyframeResolver) || KeyframeResolver;\n this.keyframeResolver = new KeyframeResolver$1(keyframes, (resolvedKeyframes, finalKeyframe, forced) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe, optionsWithDefaults, !forced), name, motionValue, element);\n (_this$keyframeResolve2 = this.keyframeResolver) === null || _this$keyframeResolve2 === void 0 || _this$keyframeResolve2.scheduleResolve();\n }\n onKeyframesResolved(keyframes, finalKeyframe, options, sync) {\n this.keyframeResolver = undefined;\n const {\n name,\n type,\n velocity,\n delay,\n isHandoff,\n onUpdate\n } = options;\n this.resolvedAt = time.now();\n /**\n * If we can't animate this value with the resolved keyframes\n * then we should complete it immediately.\n */\n if (!canAnimate(keyframes, name, type, velocity)) {\n if (MotionGlobalConfig.instantAnimations || !delay) {\n onUpdate === null || onUpdate === void 0 || onUpdate(getFinalKeyframe(keyframes, options, finalKeyframe));\n }\n keyframes[0] = keyframes[keyframes.length - 1];\n options.duration = 0;\n options.repeat = 0;\n }\n /**\n * Resolve startTime for the animation.\n *\n * This method uses the c