1 line
5.2 KiB
JSON
1 line
5.2 KiB
JSON
|
|
{"ast":null,"code":"import { progress, velocityPerSecond } from 'motion-utils';\n\n/**\n * A time in milliseconds, beyond which we consider the scroll velocity to be 0.\n */\nconst maxElapsed = 50;\nconst createAxisInfo = () => ({\n current: 0,\n offset: [],\n progress: 0,\n scrollLength: 0,\n targetOffset: 0,\n targetLength: 0,\n containerLength: 0,\n velocity: 0\n});\nconst createScrollInfo = () => ({\n time: 0,\n x: createAxisInfo(),\n y: createAxisInfo()\n});\nconst keys = {\n x: {\n length: \"Width\",\n position: \"Left\"\n },\n y: {\n length: \"Height\",\n position: \"Top\"\n }\n};\nfunction updateAxisInfo(element, axisName, info, time) {\n const axis = info[axisName];\n const {\n length,\n position\n } = keys[axisName];\n const prev = axis.current;\n const prevTime = info.time;\n axis.current = element[\"scroll\".concat(position)];\n axis.scrollLength = element[\"scroll\".concat(length)] - element[\"client\".concat(length)];\n axis.offset.length = 0;\n axis.offset[0] = 0;\n axis.offset[1] = axis.scrollLength;\n axis.progress = progress(0, axis.scrollLength, axis.current);\n const elapsed = time - prevTime;\n axis.velocity = elapsed > maxElapsed ? 0 : velocityPerSecond(axis.current - prev, elapsed);\n}\nfunction updateScrollInfo(element, info, time) {\n updateAxisInfo(element, \"x\", info, time);\n updateAxisInfo(element, \"y\", info, time);\n info.time = time;\n}\nexport { createScrollInfo, updateScrollInfo };","map":{"version":3,"names":["progress","velocityPerSecond","maxElapsed","createAxisInfo","current","offset","scrollLength","targetOffset","targetLength","containerLength","velocity","createScrollInfo","time","x","y","keys","length","position","updateAxisInfo","element","axisName","info","axis","prev","prevTime","concat","elapsed","updateScrollInfo"],"sources":["/Users/apple/Documents/cursor/Web课件/AI课/education_web_多Agent协作系统/node_modules/framer-motion/dist/es/render/dom/scroll/info.mjs"],"sourcesContent":["import { progress, velocityPerSecond } from 'motion-utils';\n\n/**\n * A time in milliseconds, beyond which we consider the scroll velocity to be 0.\n */\nconst maxElapsed = 50;\nconst createAxisInfo = () => ({\n current: 0,\n offset: [],\n progress: 0,\n scrollLength: 0,\n targetOffset: 0,\n targetLength: 0,\n containerLength: 0,\n velocity: 0,\n});\nconst createScrollInfo = () => ({\n time: 0,\n x: createAxisInfo(),\n y: createAxisInfo(),\n});\nconst keys = {\n x: {\n length: \"Width\",\n position: \"Left\",\n },\n y: {\n length: \"Height\",\n position: \"Top\",\n },\n};\nfunction updateAxisInfo(element, axisName, info, time) {\n const axis = info[axisName];\n const { length, position } = keys[axisName];\n const prev = axis.current;\n const prevTime = info.time;\n axis.current = element[`scroll${position}`];\n axis.scrollLength = element[`scroll${length}`] - element[`client${length}`];\n axis.offset.length = 0;\n axis.offset[0] = 0;\n axis.offset[1] = axis.scrollLength;\n axis.progress = progress(0, axis.scrollLength, axis.current);\n const elapsed = time - prevTime;\n axis.velocity =\n elapsed > maxElapsed\n ? 0\n : velocityPerSecond(axis.current - prev, elapsed);\n}\nfunction updateScrollInfo(element, info, time) {\n updateAxisInfo(element, \"x\", info, time);\n updateAxisInfo(element, \"y\", info, time);\n info.time = time;\n}\n\nexport { createScrollInfo, updateScrollInfo };\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,iBAAiB,QAAQ,cAAc;;AAE1D;AACA;AACA;AACA,MAAMC,UAAU,GAAG,EAAE;AACrB,MAAMC,cAAc,GAAGA,CAAA,MAAO;EAC1BC,OAAO,EAAE,CAAC;EACVC,MAAM,EAAE,EAAE;EACVL,QAAQ,EAAE,CAAC;EACXM,YAAY,EAAE,CAAC;EACfC,YAAY,EAAE,CAAC;EACfC,YAAY,EAAE,CAAC;EACfC,eAAe,EAAE,CAAC;EAClBC,QAAQ,EAAE;AACd,CAAC,CAAC;AACF,MAAMC,gBAAgB,GAAGA,CAAA,MAAO;EAC5BC,IAAI,EAAE,CAAC;EACPC,CAAC,EAAEV,cAAc,CAAC,CAAC;EACnBW,CAAC,EAAEX,cAAc,CAAC;AACtB,CAAC,CAAC;AACF,MAAMY,IAAI,GAAG;EACTF,CAAC,EAAE;IACCG,MAAM,EAAE,OAAO;IACfC,QAAQ,EAAE;EACd,CAA
|