{"version":3,"file":"Pixel_Transition.CvHunCml.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/vOBVKVSohwv6Pvy4OjF1/m0Ujnll6jbwjGiREgDhy/Pixel_Transition.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useScroll,useMotionValueEvent}from\"framer-motion\";import{useRef,useEffect,useState}from\"react\";/**\n * PIXEL RISE\n * A scroll-driven pixel-reveal overlay (catalinvintila-style random dissolve).\n * Place it as an ABSOLUTE overlay on top of the section you want to reveal, set\n * \"Warna pixel\" to the covering color (usually your page/prev-section background).\n * As the section scrolls into view, the pixels clear in random order — biased to\n * clear from the bottom first, so the content rises into place.\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicWidth 800\n * @framerIntrinsicHeight 600\n */export default function PixelRise(props){const{cols,bias,color,fade,revealAt}=props;const ref=useRef(null);const cellsRef=useRef([]);const rankRef=useRef([]);const[grid,setGrid]=useState({cols:cols,rows:1});// progress 0 -> covered, 1 -> revealed, as the element scrolls up into view\nconst{scrollYProgress}=useScroll({target:ref,offset:[\"start end\",revealAt]});// build the grid, and rebuild on resize / resolution change\nuseEffect(()=>{const el=ref.current;if(!el)return;const build=()=>{const w=el.clientWidth||1;const h=el.clientHeight||1;const cw=w/cols;const rows=Math.max(1,Math.round(h/cw));setGrid({cols,rows});};build();const ro=new ResizeObserver(build);ro.observe(el);return()=>ro.disconnect();},[cols]);// (re)compute the random-with-bottom-bias reveal order\nuseEffect(()=>{const total=grid.cols*grid.rows;const arr=[];for(let i=0;i<total;i++){const r=Math.floor(i/grid.cols);const rise=(grid.rows-1-r)/(grid.rows-1||1)// small at bottom -> bottom clears first\n;arr.push({i,w:(1-bias)*Math.random()+bias*rise});}arr.sort((a,b)=>a.w-b.w);const rank=new Array(total);arr.forEach((o,idx)=>rank[o.i]=idx);rankRef.current=rank;apply(scrollYProgress.get());// eslint-disable-next-line react-hooks/exhaustive-deps\n},[grid,bias]);const apply=p=>{const total=grid.cols*grid.rows;const cleared=Math.round(Math.max(0,Math.min(1,p))*total);const rank=rankRef.current;const cells=cellsRef.current;for(let i=0;i<total;i++){const el=cells[i];if(!el)continue;el.style.opacity=rank[i]<cleared?\"0\":\"1\";}};useMotionValueEvent(scrollYProgress,\"change\",apply);const total=grid.cols*grid.rows;cellsRef.current=[];return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{position:\"absolute\",inset:0,overflow:\"hidden\",pointerEvents:\"none\"},children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,display:\"grid\",gridTemplateColumns:`repeat(${grid.cols}, 1fr)`,gridTemplateRows:`repeat(${grid.rows}, 1fr)`},children:Array.from({length:total}).map((_,i)=>/*#__PURE__*/_jsx(\"div\",{ref:el=>cellsRef.current[i]=el,style:{background:color,opacity:1,transition:`opacity ${fade}s ease`}},i))})});}PixelRise.defaultProps={cols:20,bias:.35,color:\"#0a0a0b\",fade:.3,revealAt:\"start start\"};addPropertyControls(PixelRise,{cols:{type:ControlType.Number,title:\"Resolution\",min:6,max:60,step:1,defaultValue:20},bias:{type:ControlType.Number,title:\"Acak↔bawah\",min:0,max:1,step:.05,defaultValue:.35},fade:{type:ControlType.Number,title:\"Fade\",min:0,max:1,step:.05,defaultValue:.3},color:{type:ControlType.Color,title:\"Warna pixel\",defaultValue:\"#0a0a0b\"},revealAt:{type:ControlType.Enum,title:\"Selesai di\",options:[\"start start\",\"center center\",\"end end\"],optionTitles:[\"Atas layar\",\"Tengah layar\",\"Bawah keluar\"],defaultValue:\"start start\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PixelRise\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"600\",\"framerIntrinsicWidth\":\"800\",\"framerSupportedLayoutWid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