ohctechv3/.svn/pristine/63/63499cf991787c741239d6850eb18c2e0b0da527.svn-base

1 line
39 KiB
Plaintext
Raw Normal View History

2024-10-28 15:03:36 +05:30
{"version":3,"file":"index.es.js","sources":["../compiled/hooks/useLottie.js","../compiled/hooks/useLottieInteractivity.js","../compiled/components/Lottie.js"],"sourcesContent":["import lottie from \"lottie-web\";\nimport React, { useEffect, useRef, useState, } from \"react\";\nconst useLottie = (props, style) => {\n const { animationData, loop, autoplay, initialSegment, onComplete, onLoopComplete, onEnterFrame, onSegmentStart, onConfigReady, onDataReady, onDataFailed, onLoadedImages, onDOMLoaded, onDestroy, \n // Specified here to take them out from the 'rest'\n lottieRef, renderer, name, assetsPath, rendererSettings, \n // TODO: find a better way to extract the html props to avoid specifying\n // all the props that we want to exclude (as you can see above)\n ...rest } = props;\n const [animationLoaded, setAnimationLoaded] = useState(false);\n const animationInstanceRef = useRef();\n const animationContainer = useRef(null);\n /*\n ======================================\n INTERACTION METHODS\n ======================================\n */\n /**\n * Play\n */\n const play = () => {\n var _a;\n (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.play();\n };\n /**\n * Stop\n */\n const stop = () => {\n var _a;\n (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.stop();\n };\n /**\n * Pause\n */\n const pause = () => {\n var _a;\n (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.pause();\n };\n /**\n * Set animation speed\n * @param speed\n */\n const setSpeed = (speed) => {\n var _a;\n (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.setSpeed(speed);\n };\n /**\n * Got to frame and play\n * @param value\n * @param isFrame\n */\n const goToAndPlay = (value, isFrame) => {\n var _a;\n (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.goToAndPlay(value, isFrame);\n };\n /**\n * Got to frame and stop\n * @param value\n * @param isFrame\n */\n const goToAndStop = (value, isFrame) => {\n var _a;\n (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.goToAndStop(value, isFrame);\n };\n /**\n * Set animation direction\n * @param direction\n */\n const setDirection = (direction) => {\n var _a;\n (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.setDirection(direction);\n };\n /**\n * Play animation segments\n * @param segments\n * @param forceFlag\n */\n const playSegments = (segments, forceFlag) => {\n var _a;\n (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.playSegments(segments, forceFlag);\n };\n /**\n * Set sub frames\n * @param useSubFrames\n */\n const setSubframe = (useSubFrames) => {\n var _a;\n (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.setSubframe(useSubFrames);\n };\n /**\n * Get animation duration\n * @param inFrames\n */\n const getDuration = (inFrames) => { var _a; return (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.getDuration(inFrames); };\n /**\n * Destroy animation\n */\n const destroy = () => {\n var _a;\n (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.destroy();\n // Removing the reference to the animation so separate cleanups are skipped.\n // Without it the internal `lottie-react` instance throws exceptions as it already cleared itself on destroy.\n animationInstanceRef.current = undefined;\n };\n /*\n ======================================\n LOTTIE\n ======================================\n */\n /**\n * Load a new animation,