{"version":3,"file":"VelocityTicker.v0WIaHhC.mjs","names":[],"sources":["https:/ga.jspm.io/npm:@motionone/utils@10.14.0/dist/index.es.js","https:/framerusercontent.com/modules/QamsdEmrFPwTauw4NEU9/6enOlStU6S0mJaqvkLVC/VelocityTicker.js"],"sourcesContent":["function addUniqueItem(t,e){-1===t.indexOf(e)&&t.push(e)}function removeItem(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const clamp=(t,e,n)=>Math.min(Math.max(n,t),e);const t={duration:.3,delay:0,endDelay:0,repeat:0,easing:\"ease\"};const isNumber=t=>\"number\"===typeof t;const isEasingList=t=>Array.isArray(t)&&!isNumber(t[0]);const wrap=(t,e,n)=>{const o=e-t;return((n-t)%o+o)%o+t};function getEasingForSegment(t,e){return isEasingList(t)?t[wrap(0,t.length,e)]:t}const mix=(t,e,n)=>-n*t+n*e+t;const noop=()=>{};const noopReturn=t=>t;const progress=(t,e,n)=>e-t===0?1:(n-t)/(e-t);function fillOffset(t,e){const n=t[t.length-1];for(let o=1;o<=e;o++){const s=progress(0,e,o);t.push(mix(n,1,s))}}function defaultOffset(t){const e=[0];fillOffset(e,t-1);return e}function interpolate(t,e=defaultOffset(t.length),n=noopReturn){const o=t.length;const s=o-e.length;s>0&&fillOffset(e,s);return s=>{let f=0;for(;f<o-2;f++)if(s<e[f+1])break;let r=clamp(0,1,progress(e[f],e[f+1],s));const c=getEasingForSegment(n,f);r=c(r);return mix(t[f],t[f+1],r)}}const isCubicBezier=t=>Array.isArray(t)&&isNumber(t[0]);const isEasingGenerator=t=>\"object\"===typeof t&&Boolean(t.createAnimation);const isFunction=t=>\"function\"===typeof t;const isString=t=>\"string\"===typeof t;const e={ms:t=>1e3*t,s:t=>t/1e3};\n/*\n  Convert velocity into velocity per second\n\n  @param [number]: Unit per frame\n  @param [number]: Frame duration in ms\n*/function velocityPerSecond(t,e){return e?t*(1e3/e):0}export{addUniqueItem,clamp,defaultOffset,t as defaults,fillOffset,getEasingForSegment,interpolate,isCubicBezier,isEasingGenerator,isEasingList,isFunction,isNumber,isString,mix,noop,noopReturn,progress,removeItem,e as time,velocityPerSecond,wrap};\n\n//# sourceMappingURL=index.es.js.map","import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef}from\"react\";import{motion,useScroll,useSpring,useTransform,useMotionValue,useVelocity,useAnimationFrame}from\"framer-motion\";import{wrap}from\"@motionone/utils\";import{addPropertyControls,ControlType}from\"framer\";/**\n *\n * framer.today/license\n *\n */function ParallaxText({text,baseVelocity,textStyle,gap,color}){const baseX=useMotionValue(0);const{scrollY}=useScroll();const scrollVelocity=useVelocity(scrollY);const smoothVelocity=useSpring(scrollVelocity,{damping:50,stiffness:150});const velocityFactor=useTransform(smoothVelocity,[0,50],[0,1],{clamp:false});const x=useTransform(baseX,v=>`${wrap(-25,0,v)}%`);const directionFactor=useRef(1);useAnimationFrame((t,delta)=>{if(scrollVelocity<0){directionFactor.current=-1;}else if(scrollVelocity>0){directionFactor.current=1;}let moveBy=directionFactor.current*baseVelocity*(delta/1e3);moveBy+=directionFactor.current*.01*velocityFactor.get();baseX.set(baseX.get()+moveBy);});const containerStyle={display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",alignItems:\"center\",width:\"100%\",height:\"100%\",overflow:\"hidden\",userSelect:\"none\",...textStyle};const scrollerStyle={display:\"flex\",whiteSpace:\"nowrap\",willChange:\"transform\",userSelect:\"none\"};const spanStyle={marginRight:`${gap}px`,color:color};return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,children:/*#__PURE__*/_jsxs(motion.div,{style:{...scrollerStyle,x},children:[/*#__PURE__*/_jsx(\"span\",{style:spanStyle,children:text}),/*#__PURE__*/_jsx(\"span\",{style:spanStyle,children:text}),/*#__PURE__*/_jsx(\"span\",{style:spanStyle,children:text}),/*#__PURE__*/_jsx(\"span\",{style:spanStyle,children:text})]})});}/**\n *\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicWidth 450\n * @framerIntrinsicHeight 150\n */export default function VelocityTicker(props){const{text,baseVelocity,textStyle,gap,color}=props;return /*#__PURE__*/_jsx(\"div\",{children:/*#__PURE__*/_jsx(ParallaxText,{text:text,baseVelocity:baseVelocity,textStyle:textStyle,gap:gap,color:color})});}VelocityTicker.defaultProps={text:\"Hello World\",baseVelocity:1,textStyle:{fontFamily:\"Manrope, sans-serif\",fontSize:\"80px\",lineHeight:\"1.5em\"},color:\"#ffffff\",gap:12};addPropertyControls(VelocityTicker,{text:{type:ControlType.String,title:\"Text\"},baseVelocity:{type:ControlType.Number,title:\"Base Velocity\",defaultValue:1,min:0,max:10,step:.1},color:{title:\"Color\",type:ControlType.Color,defaultValue:\"#ffffff\"},textStyle:{type:ControlType.Font,controls:\"extended\",title:\"Font\",displayTextAlignment:false,displayFontSize:true,defaultValue:{fontSize:40,lineHeight:\"1.5em\"}},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:12,displayStepper:true,min:0,max:50,step:1,description:`\n        \n        *from framer.today*\n [License](https://framer.today/license)\n    `}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VelocityTicker\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"450\",\"framerSupportedLayoutWidth\":\"any\",\"framerIntrinsicHeight\":\"150\",\"framerDisableUnlink\":\"*\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./VelocityTicker.map"],"mappings":"odAA8U,EAAK,CAAC,EAAE,EAAE,IAAI,CAAC,IAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,CAAE,ICI5X,SAAS,EAAa,CAAC,OAAK,eAAa,YAAU,MAAI,QAAM,CAAC,CAAC,IAAM,EAAM,EAAe,EAAE,CAAM,CAAC,UAAQ,CAAC,GAAW,CAAO,EAAe,EAAY,EAAQ,C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