This repository has been archived by the owner on May 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrp-cursor.js
2 lines (2 loc) · 1.89 KB
/
rp-cursor.js
1
2
/*! For license information please see rp-cursor.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("liqvid")):"function"==typeof define&&define.amd?define(["react","liqvid"],t):"object"==typeof exports?exports.RPCursor=t(require("react"),require("liqvid")):e.RPCursor=t(e.React,e.Liqvid)}(self,(function(e,t){return(()=>{"use strict";var r={995:e=>{e.exports=t},359:t=>{t.exports=e}},o={};function n(e){var t=o[e];if(void 0!==t)return t.exports;var i=o[e]={exports:{}};return r[e](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{n.r(i),n.d(i,{default:()=>s});var e=n(359),t=n(995);const{replay:r}=t.Utils.animation,{between:o}=t.Utils.misc;function s(n){const{playback:i,script:s}=(0,t.usePlayer)(),c=e.useRef(),a=s.parseStart(n.start),u=s.parseEnd(n.end);e.useEffect((()=>{const{display:e}=c.current.style;c.current.style.display="block";const{height:t,width:o}=c.current.getBoundingClientRect();c.current.style.display=e;const s=r({data:n.replay,start:a,end:u,active:([e,r])=>{Object.assign(c.current.style,{opacity:1,left:`calc(${e}% - ${o/2}px)`,top:`calc(${r}% - ${t/2}px)`})},inactive:()=>{c.current.style.opacity="0"},compressed:!0});return i.hub.on("seek",s),i.hub.on("timeupdate",s),s(i.currentTime),()=>{i.hub.off("seek",s),i.hub.off("timeupdate",s)}}),[c.current]);const l={pointerEvents:"none",position:"absolute",zIndex:1e3};return o(a,i.currentTime,u)&&(l.opacity=0),e.createElement("img",{className:"rp-cursor",ref:c,src:n.src,style:l})}})(),i})()}));