COMING SOON
SITE REBUILD IN PROGRESS
Pixel Self is becoming a home for practical artist-to-artist education, production experiments, and the ongoing making of an original 3D short.
MAKE / BREAK / LEARN
SEE WHAT'S COMING
WHAT WILL LIVE HERE

THE CREATIVE ARCHIVE

◆Step-by-step tutorials and visual production guides
◆Frame Rot production fragments and development notes
◆Mixed-reality art and VR workflow experiments
◆3D, animation, Unreal, ZBrush, and character pipeline breakdowns
◆The fixes, mistakes, and dead ends that are usually edited out
WHAT PIXEL SELF IS BECOMING

A LIVING KNOWLEDGE Of workflows FOR ARTISTS

Not a polished manual written after the fact. Pixel Self documents real workflows while they are being used: what worked, what broke, what changed, and what is worth carrying into your next project.

01 / LEARN

TUTORIALS

Practical, visual walkthroughs built from the tools actually used in production: mixed reality, Substance 3D Modeler, Character Creator, iClone, Unreal Engine, ZBrush, streaming tools, and more.

02 / MAKE

WORKFLOWS

Production notes, experiments, troubleshooting, discoveries, and repeatable pipelines. The useful stuff that usually gets lost between finished images and finished films.

03 / BUILD IN PUBLIC

FRAME ROT

A running production journal built from render tests, animation passes, lighting studies, failures, revisions, and the decisions between versions.

04 / SHARE

LIVE GALLERY

Submit your artwork, experiments, studies, and finished pieces for the upcoming community gallery. Submissions are reviewed, and artist credit is always included.

EXPLORE THE LIVE GALLERY →
SHORT-FORM CG / PRODUCTION JOURNAL

FRAME ROT

The finished short is only part of the story. Pixel Self will also show the daily problem-solving behind it: sculpting passes, animation tests, lighting studies, rendering experiments, technical failures, and the revisions that move the project forward.

This section is deliberately a production diary rather than a highlight reel.

SOOO CLOSE TO LAUNCHING

COME BACK SOON!

Pixel Self is being rebuilt into something useful rather than rushed into public. If you want a launch notice, use the button below. You can also follow the build as it happens.

PIXEL SELF · CREATED BY CS MURPHY · MIXED REALITY ARTIST

PIXEL SELF · LAUNCH LIST

YOU’RE ON THE LIST!

Thanks for joining. Your email is saved, and we’ll keep you updated when Pixel Self is ready to launch.

04 / SHARE · LIVE GALLERY

BECOME PART OF THE LIVE GALLERY

Show us what you're making. Submit a finished piece, experiment, or work in progress for the upcoming community gallery.

MADE BY HUMANS

A space for human imagination, skill, and practice. All styles and experience levels are welcome.

Submissions are reviewed before publication. Your email is used to contact you about your submission and is not displayed in the gallery.

Already have a profile? Sign in to add more artwork.

':clone.outerHTML); const blob=new Blob([doc],{type:"text/html"}); const a=document.createElement("a"); a.href=URL.createObjectURL(blob); a.download="pixelself-editor-v16.html"; document.body.appendChild(a);a.click();a.remove(); setTimeout(()=>URL.revokeObjectURL(a.href),60000); const btn=document.getElementById("saveForChatGPT"); const dock=document.getElementById("saveDock"); if(btn){ const old=btn.textContent; btn.textContent="SAVED ✓ — ATTACH THIS FILE"; if(dock){dock.classList.remove("savedPulse");void dock.offsetWidth;dock.classList.add("savedPulse")} setTimeout(()=>btn.textContent=old,1800); } } const SUBSCRIBE_SEEN_KEY="pixelSelfSubscribeSeen_v1"; let subscribeRuntimeStarted=false; function wireSubscriptionPopup(){ if(subscribeRuntimeStarted)return; subscribeRuntimeStarted=true; const pop=document.getElementById("subscribePop"); const close=document.getElementById("subscribeClose"); const notNow=document.getElementById("subscribeNotNow"); const previewBtn=document.getElementById("previewSubscribePopup"); const previewToggle=document.getElementById("popupPreviewNow"); const resetBtn=document.getElementById("resetSubscribePopup"); const form=document.getElementById("subscribeForm"); const email=document.getElementById("subscribeEmail"); const message=document.getElementById("subscribeMessage"); if(!pop)return; const centerPopupContent=()=>pop.style.setProperty("--pop-content-scale",Math.min(1,pop.clientWidth/470,pop.clientHeight/470)); centerPopupContent(); if(window.ResizeObserver)new ResizeObserver(centerPopupContent).observe(pop); else window.addEventListener("resize",centerPopupContent); let dwellReady=false; let scrollReady=false; let shownThisPage=false; let minTimer=0; let fallbackTimer=0; function now(){return Date.now()} function repeatMs(){return Math.max(1,Number(state.popupFrequencyDays)||7)*86400000} function recentlySeen(){ try{ const t=Number(localStorage.getItem(SUBSCRIBE_SEEN_KEY)||0); return t>0 && now()-tpw.clientHeight+5){ top=pw.scrollTop; max=Math.max(1,pw.scrollHeight-pw.clientHeight); } return (top/max)*100; } function onScroll(){ scrollReady=scrollPercent()>=(Number(state.popupScroll)||35); engagementCheck(); } function schedule(){ clearTimeout(minTimer);clearTimeout(fallbackTimer); dwellReady=false;scrollReady=false;shownThisPage=false; if(!state.popupEnabled||recentlySeen())return; minTimer=setTimeout(()=>{dwellReady=true;onScroll()},Math.max(1,Number(state.popupDelay)||25)*1000); fallbackTimer=setTimeout(()=>openPopup(false),Math.max(Number(state.popupDelay)||25,Number(state.popupFallback)||60)*1000); } const previewWrap=document.querySelector(".previewWrap"); window.addEventListener("scroll",onScroll,{passive:true}); if(previewWrap)previewWrap.addEventListener("scroll",onScroll,{passive:true}); if(close)close.addEventListener("click",()=>closePopup(true)); if(notNow)notNow.addEventListener("click",()=>closePopup(true)); if(previewToggle)previewToggle.addEventListener("change",()=>{clearTimeout(minTimer);clearTimeout(fallbackTimer);if(previewToggle.checked)openPopup(true);else closePopup(false);}); if(previewBtn)previewBtn.addEventListener("click",()=>openPopup(true)); if(resetBtn)resetBtn.addEventListener("click",()=>{ try{localStorage.removeItem(SUBSCRIBE_SEEN_KEY)}catch(e){} shownThisPage=false; if(message)message.textContent="Popup timer reset."; schedule(); }); document.addEventListener("keydown",ev=>{if(ev.key==="Escape"&&pop.classList.contains("open"))closePopup(true)}); let joining=false; document.getElementById('mailLink')?.addEventListener('click',event=>{event.preventDefault();openPopup(true);email.focus();}); if(form){form.addEventListener('submit',async ev=>{ ev.preventDefault();if(joining||!validatePixelForm(form))return; if(!PUBLIC_PAGE||location.protocol==='file:'){message.textContent='Preview only — no signup was sent.';openSignupConfirmation(true);return;} joining=true;const button=form.querySelector('button');button.disabled=true;message.textContent='Joining…'; const controller=new AbortController(),timeout=setTimeout(()=>controller.abort(),30000); try{ const body=new URLSearchParams();body.set('email',email.value.trim()); const endpoint=new URL(state.subscriptionEndpoint||'subscribe.php',location.href); if(endpoint.origin!==location.origin)throw Error('The signup receiver must be on this website.'); const response=await fetch(endpoint,{method:'POST',body,signal:controller.signal,headers:{Accept:'application/json'}}); let data;try{data=await response.json();}catch(e){throw Error('The signup receiver is unavailable. Please try again later.');} if(!response.ok||data.ok!==true){showServerFieldErrors(form,data.fields||{});throw Error(data.error||'Please try again.');} markSeen();closePopup(false);message.textContent='';form.reset();openSignupConfirmation(false); }catch(error){message.textContent=error.name==='AbortError'?'The request timed out. Please try again shortly.':error.message;} finally{clearTimeout(timeout);joining=false;button.disabled=false;} });} schedule(); } let sectionScrollRAF=0; function wireSmoothSectionNavigation(){ const prefersReduced=()=>window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches; function easeInOutQuint(t){ return t<.5 ? 16*t*t*t*t*t : 1-Math.pow(-2*t+2,5)/2; } function animateScroll(scroller,to,duration){ if(sectionScrollRAF)cancelAnimationFrame(sectionScrollRAF); const isWindow=scroller===window; const start=isWindow ? (window.scrollY||document.documentElement.scrollTop||0) : scroller.scrollTop; const distance=to-start; const startTime=performance.now(); function frame(now){ const p=Math.min(1,(now-startTime)/Math.max(1,duration)); const eased=easeInOutQuint(p); const pos=start+distance*eased; if(isWindow)window.scrollTo(0,pos); else scroller.scrollTop=pos; if(p<1)sectionScrollRAF=requestAnimationFrame(frame); else sectionScrollRAF=0; } sectionScrollRAF=requestAnimationFrame(frame); } document.querySelectorAll('a[href^="#"]').forEach(anchor=>{ anchor.addEventListener("click",ev=>{ const href=anchor.getAttribute("href"); if(!href||href==="#"||href.length<2)return; const target=document.querySelector(href); if(!target)return; ev.preventDefault(); const previewWrap=anchor.closest(".previewWrap"); const usePreviewScroller=previewWrap && previewWrap.contains(target); const scroller=usePreviewScroller ? previewWrap : window; const topbar=usePreviewScroller ? previewWrap.querySelector(".topbar") : null; const chromeOffset=(topbar?.offsetHeight||0)+(Number(state.scrollOffset)||0); let destination; if(scroller===window){ destination=target.getBoundingClientRect().top+(window.scrollY||document.documentElement.scrollTop||0)-chromeOffset; }else{ const sr=previewWrap.getBoundingClientRect(); const tr=target.getBoundingClientRect(); destination=previewWrap.scrollTop+(tr.top-sr.top)-chromeOffset; } destination=Math.max(0,destination); if(!state.smoothScrollEnabled||prefersReduced()){ if(scroller===window)window.scrollTo(0,destination); else scroller.scrollTop=destination; return; } animateScroll(scroller,destination,Number(state.scrollDuration)||1050); }); }); } function wirePreviewEditorNavigator(){ const editor=document.querySelector(".editor"); const sections=[...document.querySelectorAll("#pagePreview section[data-editor-target]")]; function clearFocus(){ document.querySelectorAll(".group.editorFocus").forEach(el=>el.classList.remove("editorFocus")); document.querySelectorAll("#pagePreview .previewFocus").forEach(el=>el.classList.remove("previewFocus")); } sections.forEach(section=>{ section.addEventListener("click",ev=>{ if(ev.target.closest("a,button,input,textarea,select,label,#imageBox")) return; const group=document.getElementById(section.dataset.editorTarget); if(!group||!editor) return; clearFocus(); group.open=true; group.classList.add("editorFocus"); section.classList.add("previewFocus"); const targetTop=Math.max(0,group.offsetTop-14); editor.scrollTo({top:targetTop,behavior:"smooth"}); window.setTimeout(()=>{ group.classList.remove("editorFocus"); section.classList.remove("previewFocus"); },2200); }); }); } // Soft display-only drift; the official particle canvas is never modified. let chromaTimer=0,chromaEndTimer=0,chromaTrailRAF=0,chromaLastTrail=0; function clearChroma(){document.querySelectorAll('.chroma-active').forEach(el=>el.classList.remove('chroma-active'));} function chromaReduced(){return window.matchMedia('(prefers-reduced-motion: reduce)').matches;} function syncChromaTargets(){ const root=document.documentElement,offset=clamp(Number(state.chromaOffset)||0,0,12); const strength=clamp(Number(state.chromaStrength)||0,0,100)/100; const low=state.chromaMode==='pulse'?0:strength*clamp(Number(state.chromaFringe)||0,0,100)/100*.4; const values={'--chroma-x':offset+'px','--chroma-nx':-offset+'px','--chroma-y':(offset*.35)+'px','--chroma-ny':(-offset*.35)+'px','--chroma-blur':(Number(state.chromaSoftness)||0)+'px','--chroma-warp':(Number(state.chromaWarp)||0)+'deg','--chroma-nwarp':-(Number(state.chromaWarp)||0)+'deg','--chroma-cycle':(Math.max(.5,Number(state.chromaFadeSeconds)||3)*2+Math.max(0,Number(state.chromaInterval)||0))+'s','--chroma-a':hexToRgba(state.chromaColorA,strength),'--chroma-b':hexToRgba(state.chromaColorB,strength),'--chroma-low-a':hexToRgba(state.chromaColorA,low),'--chroma-low-b':hexToRgba(state.chromaColorB,low),'--chroma-trail-alpha':strength}; Object.entries(values).forEach(([k,v])=>root.style.setProperty(k,v)); root.dataset.chromaMode=chromaReduced()?'steady':state.chromaMode; // Explicitly exclude BOTH popups, including their logo canvas. document.querySelectorAll('.chroma-heading,.chroma-logo,.chroma-alt').forEach(el=>{if(el.closest('#galleryDialog,#subscribePop'))el.classList.remove('chroma-heading','chroma-logo','chroma-alt','chroma-active');}); document.getElementById('subscriptionMarkCanvas').style.removeProperty('filter'); document.getElementById('motionLogoCanvas').classList.toggle('chroma-logo',!!state.chromaLogo&&state.chromaTrailFont==='same'); const fontMap={mono:'"Courier New", monospace',impact:'Impact, "Arial Black", sans-serif',bear:'"Bear Days", sans-serif',custom:'"PixelSelfTrail", monospace'}; const font=fontMap[state.chromaTrailFont]||fontMap.mono; root.style.setProperty('--chroma-trail-font',font); let fontStyle=document.getElementById('custom-trail-font'); if(!fontStyle){fontStyle=document.createElement('style');fontStyle.id='custom-trail-font';document.head.appendChild(fontStyle);} fontStyle.textContent=state.chromaTrailFontData?'@font-face{font-family:"PixelSelfTrail";src:url("'+state.chromaTrailFontData+'");font-display:swap;}':''; document.querySelectorAll('#pagePreview h1,#pagePreview h2,#pagePreview h3,#heroStatusView').forEach(el=>{ if(el.closest('#subscribePop,#galleryDialog'))return; const enabled=!!state.chromaHeadings&&/bear days/i.test(getComputedStyle(el).fontFamily); el.classList.toggle('chroma-heading',enabled);el.classList.toggle('chroma-alt',enabled&&state.chromaTrailFont!=='same'); el.dataset.chromaText=el.textContent; }); const wrap=document.getElementById('motionLogoWrap'); wrap.classList.toggle('chroma-alternate-logo',!!state.chromaLogo&&state.chromaTrailFont!=='same'); if(state.chromaLogo&&state.chromaTrailFont!=='same'&&!document.hidden){if(!chromaTrailRAF)chromaTrailRAF=requestAnimationFrame(drawAlternateLogoTrails);} else{cancelAnimationFrame(chromaTrailRAF);chromaTrailRAF=0;} const status=document.getElementById('chromaStatus');if(status)status.textContent=chromaReduced()?'Reduced motion: a steady color trail. Both popups are excluded.':'Soft continuous drift and fade. Both popups are excluded. Hold freezes a visible trail for editing.'; } function drawAlternateLogoTrails(time){ chromaTrailRAF=0;if(document.hidden||!state.chromaLogo||state.chromaTrailFont==='same')return; if(time-chromaLastTrail>32){ chromaLastTrail=time; const source=document.getElementById('motionLogoCanvas'),wrap=document.getElementById('motionLogoWrap'); ['a','b'].forEach((key,index)=>{ let trail=document.getElementById('logoTrail'+key); if(!trail){trail=document.createElement('canvas');trail.id='logoTrail'+key;trail.className='logoFontTrail trail-'+key;trail.setAttribute('aria-hidden','true');wrap.appendChild(trail);} if(trail.width!==source.width||trail.height!==source.height){trail.width=source.width;trail.height=source.height;} const ctx=trail.getContext('2d'),w=trail.width,h=trail.height; ctx.clearRect(0,0,w,h);ctx.globalCompositeOperation='source-over'; const family={mono:'"Courier New", monospace',impact:'Impact, sans-serif',bear:'"Bear Days", sans-serif',custom:'"PixelSelfTrail", monospace'}[state.chromaTrailFont]||'monospace'; let size=h*.67;ctx.font='900 '+size+'px '+family; size*=Math.min(1,(w*.91)/Math.max(1,ctx.measureText('PIXEL SELF.ART').width));ctx.font='900 '+size+'px '+family; ctx.textAlign='center';ctx.textBaseline='middle';ctx.fillStyle=index?state.chromaColorB:state.chromaColorA; ctx.fillText('PIXEL SELF.ART',w/2,h/2); // The alternate glyphs inherit current cutouts; they cannot refill removed pieces. ctx.globalCompositeOperation='destination-in';ctx.drawImage(source,0,0,w,h);ctx.globalCompositeOperation='source-over'; }); } chromaTrailRAF=requestAnimationFrame(drawAlternateLogoTrails); } function pulseChroma(){ const root=document.documentElement;root.dataset.chromaHold='true'; const hold=document.getElementById('chromaHold');if(hold)hold.checked=true; } function scheduleChroma(){/* Continuous CSS interpolation replaces abrupt pulse timers. */} function wireChroma(){ document.getElementById('chromaPreview')?.addEventListener('click',pulseChroma); document.getElementById('chromaHold')?.addEventListener('change',ev=>{document.documentElement.dataset.chromaHold=String(ev.target.checked);}); const preference=window.matchMedia('(prefers-reduced-motion: reduce)');preference.addEventListener?.('change',syncChromaTargets); document.addEventListener('visibilitychange',syncChromaTargets); document.fonts?.ready.then(syncChromaTargets); const upload=document.getElementById('chromaTrailFontUpload');upload?.addEventListener('change',()=>{ const file=upload.files[0];if(!file)return; if(!/\.(ttf|otf|woff2?)$/i.test(file.name)||file.size>2*1024*1024){alert('Choose a TTF, OTF, WOFF or WOFF2 font under 2 MB.');return;} const reader=new FileReader();reader.onload=()=>{state.chromaTrailFontData=reader.result;state.chromaTrailFont='custom';setInputs();apply();};reader.readAsDataURL(file); }); } function positionGalleryPreview(){ if(PUBLIC_PAGE)return; const dialog=document.getElementById('galleryDialog'),backdrop=document.getElementById('galleryEditorBackdrop'); if(!dialog?.open)return; const area=document.querySelector('.previewWrap').getBoundingClientRect(); const sideBySide=window.innerWidth>760; const left=sideBySide?Math.max(0,area.left):0; const width=Math.max(1,window.innerWidth-left); backdrop.style.left=left+'px'; dialog.style.left=(left+width/2)+'px'; dialog.style.maxWidth=Math.max(280,width-28)+'px'; } function syncPopupEditorStyles(){ const root=document.documentElement; for(const [key,variable] of [['galleryBg','--gallery-bg'],['galleryTextColor','--gallery-text'],['galleryHeadingColor','--gallery-heading'],['galleryAccent','--gallery-accent'],['galleryButtonColor','--gallery-button'],['galleryButtonTextColor','--gallery-button-text']])root.style.setProperty(variable,state[key]); for(const [key,variable] of [['galleryWidth','--gallery-width'],['galleryHeadingSize','--gallery-heading-size'],['galleryRadius','--gallery-radius'],['galleryBlur','--gallery-blur']])root.style.setProperty(variable,Number(state[key])+'px'); root.style.setProperty('--gallery-backdrop',hexToRgba('#04080E',clamp(Number(state.galleryBackdropOpacity),0,100)/100)); const form=document.getElementById('galleryForm'); form.querySelector('[name="description"]').placeholder=state.galleryDescriptionPlaceholder; form.querySelector('[name="humanStatement"]').value=state.galleryHumanConfirmation; form.querySelector('[name="permissionStatement"]').value=state.galleryPermission; const popup=document.getElementById('subscribePop'); popup.style.setProperty('--pop-hover',state.popupHoverColor); popup.style.setProperty('--popup-heading-size',Number(state.popupHeadingSize)+'px'); popup.style.setProperty('--popup-heading-color',state.popupHeadingColor); popup.style.setProperty('--popup-text-color',state.popupTextColor); root.style.setProperty('--gallery-align',state.galleryTextAlign); root.style.setProperty('--gallery-fields-align',state.galleryFieldsAlign); root.style.setProperty('--launch-align',state.popupTextAlign); root.style.setProperty('--confirmation-align',state.signupConfirmAlign); const launchDate=document.getElementById('popupLaunchDateView'); launchDate.hidden=!state.popupLaunchDate;launchDate.textContent=state.popupLaunchDate?state.popupDateLabel+' '+state.popupLaunchDate:''; syncSocialFooter();positionGalleryPreview(); } function focusPopupEditor(id){ if(PUBLIC_PAGE)return;const group=document.getElementById(id);if(!group)return;group.open=true; document.querySelector('.editor').scrollTo({top:Math.max(0,group.offsetTop-15),behavior:'smooth'}); } function wirePopupEditorShortcuts(){ document.querySelectorAll('[data-edit-panel]').forEach(button=>button.addEventListener('click',()=>{ const id=button.dataset.editPanel;focusPopupEditor(id); if(id==='editorGallery')document.getElementById('galleryPreviewButton').click(); else if(id==='editorSubscribe')document.getElementById('previewSubscribePopup').click(); else if(id==='editorSignupConfirm')openSignupConfirmation(true); })); if(!PUBLIC_PAGE)for(const [popup,id]of [['galleryDialog','editorGallery'],['subscribePop','editorSubscribe'],['signupConfirmation','editorSignupConfirm']])document.getElementById(popup)?.addEventListener('click',()=>focusPopupEditor(id)); } function resetGalleryClone(clone){ clone.querySelector('#signupConfirmation')?.removeAttribute('open'); clone.querySelector('#signupConfirmation')?.classList.remove('confirmation-editor-preview'); clone.querySelector('#signupConfirmation')?.style.removeProperty('left'); clone.querySelectorAll('.field-error').forEach(el=>el.remove()); clone.querySelectorAll('[aria-invalid]').forEach(el=>{el.removeAttribute('aria-invalid');el.removeAttribute('aria-describedby');}); clone.querySelectorAll('.logoFontTrail').forEach(el=>el.remove()); const dialog=clone.querySelector('#galleryDialog'); if(!dialog)return; dialog.removeAttribute('open');dialog.classList.remove('gallery-editor-preview');dialog.style.removeProperty('left');dialog.style.removeProperty('max-width'); clone.querySelector('#galleryEditorBackdrop')?.setAttribute('hidden',''); clone.querySelector('#galleryPreviewNow')?.removeAttribute('checked'); clone.querySelector('#chromaHold')?.removeAttribute('checked'); clone.querySelector('html')?.removeAttribute('data-chroma-hold');clone.removeAttribute('data-chroma-hold'); dialog.querySelectorAll('input,textarea').forEach(el=>{el.removeAttribute('value');el.removeAttribute('checked');if(el.tagName==='TEXTAREA')el.textContent='';}); dialog.querySelectorAll('[type=checkbox]').forEach(el=>el.setAttribute('value','yes')); const img=dialog.querySelector('#galleryPreview');img.removeAttribute('src');img.hidden=true; const message=dialog.querySelector('#galleryMessage');message.textContent='';message.removeAttribute('data-success');message.removeAttribute('data-error'); const submit=dialog.querySelector('#gallerySubmit');submit.disabled=false;submit.textContent=state.gallerySubmitText; clone.querySelectorAll('.chroma-active').forEach(el=>el.classList.remove('chroma-active')); } function wireGallery(){ const dialog=document.getElementById('galleryDialog'),form=document.getElementById('galleryForm'); const input=document.getElementById('galleryArtwork'),preview=document.getElementById('galleryPreview'); const message=document.getElementById('galleryMessage'),submit=document.getElementById('gallerySubmit'); let objectURL='',lastFocus=null,busy=false,decoded=false; const report=(text,error=false,success=false)=>{message.textContent=text;message.dataset.error=String(error);message.dataset.success=String(success);}; function clearPreview(){if(objectURL)URL.revokeObjectURL(objectURL);objectURL='';preview.removeAttribute('src');preview.hidden=true;decoded=false;} function open(){ if(dialog.open)return; lastFocus=document.activeElement; document.getElementById('subscribePop')?.classList.remove('open'); document.getElementById('subscribePop')?.setAttribute('aria-hidden','true'); const toggle=document.getElementById('popupPreviewNow');if(toggle)toggle.checked=false; if(PUBLIC_PAGE){dialog.showModal();form.elements.name.focus();} else{dialog.classList.add('gallery-editor-preview');dialog.show();document.getElementById('galleryEditorBackdrop').hidden=false;document.getElementById('galleryPreviewNow').checked=true;positionGalleryPreview();} syncChromaTargets(); } document.getElementById('galleryOpen').addEventListener('click',open); document.getElementById('galleryPreviewButton')?.addEventListener('click',open); document.getElementById('galleryClose').addEventListener('click',()=>dialog.close()); dialog.addEventListener('close',()=>{document.getElementById('galleryEditorBackdrop').hidden=true;const toggle=document.getElementById('galleryPreviewNow');if(toggle)toggle.checked=false;lastFocus?.focus();}); document.getElementById('galleryPreviewNow')?.addEventListener('change',ev=>{if(ev.target.checked)open();else dialog.close();}); document.addEventListener('keydown',ev=>{if(!PUBLIC_PAGE&&ev.key==='Escape'&&dialog.open)dialog.close();}); window.addEventListener('resize',positionGalleryPreview); input.addEventListener('change',()=>{ clearPreview();input.setCustomValidity('');report(''); const file=input.files[0];if(!file)return; if(!['image/jpeg','image/png','image/webp'].includes(file.type)||file.size>8*1024*1024){input.setCustomValidity('Choose a JPG, PNG, or WebP no larger than 8 MB.');report(input.validationMessage,true);return;} const candidate=URL.createObjectURL(file);objectURL=candidate; preview.onload=()=>{ if(objectURL!==candidate)return; if(preview.naturalWidth>8000||preview.naturalHeight>8000||preview.naturalWidth*preview.naturalHeight>32000000){clearPreview();input.setCustomValidity('Use an image up to 8,000 pixels per side and 32 megapixels.');report(input.validationMessage,true);return;} decoded=true;preview.hidden=false; }; preview.onerror=()=>{if(objectURL!==candidate)return;clearPreview();input.setCustomValidity('This image could not be opened. Please select another file.');report(input.validationMessage,true);}; preview.src=candidate; }); form.addEventListener('submit',async event=>{ event.preventDefault();if(busy||!validatePixelForm(form))return; if(!decoded){report('Please select a valid image and wait for its preview.',true);return;} if(!PUBLIC_PAGE||location.protocol==='file:'){report('Preview only — nothing was sent. Upload the website and gallery-submit.php to your server to accept entries.');return;} busy=true;submit.disabled=true;submit.textContent='SENDING…';report('Uploading your artwork…'); const controller=new AbortController(),timeout=setTimeout(()=>controller.abort(),60000); try{ const endpoint=new URL(state.galleryEndpoint||'gallery-submit.php',location.href); if(endpoint.origin!==location.origin)throw new Error('The gallery receiver must be on this website.'); const payload=new FormData(form);payload.set('humanStatement',state.galleryHumanConfirmation);payload.set('permissionStatement',state.galleryPermission); const response=await fetch(endpoint,{method:'POST',body:payload,signal:controller.signal,headers:{'Accept':'application/json'}}); let data;try{data=await response.json();}catch(e){throw new Error('The gallery receiver is unavailable. Please try again later.');} if(!response.ok||data.ok!==true){showServerFieldErrors(form,data.fields||{});throw new Error(data.error||'Your submission could not be saved. Please try again.');} form.reset();clearPreview();report((data.message||state.gallerySuccess)+' Reference: '+data.id,false,true); }catch(error){report(error.name==='AbortError'?'The upload timed out. It may have arrived; please wait before retrying.':error.message,true);} finally{clearTimeout(timeout);busy=false;submit.disabled=false;submit.textContent=state.gallerySubmitText;} }); } function fieldError(input,text){ input.setAttribute('aria-invalid','true');const error=document.createElement('span');error.className='field-error';error.textContent=text; error.id=(input.id||input.name||'field')+'-error';input.setAttribute('aria-describedby',error.id);(input.closest('label')||input.parentElement).appendChild(error); } function validatePixelForm(form){ form.querySelectorAll('.field-error').forEach(e=>e.remove());form.querySelectorAll('[aria-invalid]').forEach(e=>{e.removeAttribute('aria-invalid');e.removeAttribute('aria-describedby');});let first=null; for(const input of form.querySelectorAll('input,textarea,select')){ if(input.type==='hidden'||input.name==='website_trap')continue; if(!input.checkValidity()){fieldError(input,input.validity.valueMissing?(input.type==='checkbox'?'Please confirm this before submitting.':'This field is required.'):input.type==='email'?'Please enter a valid email address.':input.validationMessage||'Please check this field.');first=first||input;} } if(first)first.focus();return !first; } function showServerFieldErrors(form,fields){for(const [name,text]of Object.entries(fields)){const input=form.querySelector('[name="'+name.replace(/[^a-zA-Z0-9_]/g,'')+'"]');if(input)fieldError(input,text);}} function openSignupConfirmation(preview=false){ const dialog=document.getElementById('signupConfirmation');document.getElementById('signupPreviewNote').hidden=!preview; document.getElementById('subscribePop').classList.remove('open');document.getElementById('subscribePop').setAttribute('aria-hidden','true'); const toggle=document.getElementById('popupPreviewNow');if(toggle)toggle.checked=false; if(dialog.open)return; if(PUBLIC_PAGE)dialog.showModal();else{dialog.classList.add('confirmation-editor-preview');const area=document.querySelector('.previewWrap').getBoundingClientRect();dialog.style.left=(window.innerWidth>760?(area.left+(window.innerWidth-area.left)/2):window.innerWidth/2)+'px';dialog.show();} } function syncSocialFooter(){ const links=document.getElementById('socialLinks');if(!links)return;links.replaceChildren(); for(const brand of ['Instagram','Facebook','TikTok','YouTube','Twitch','Pinterest','Bluesky','Threads']){ const raw=(state['social'+brand]||'').trim();if(!raw)continue;let url;try{url=new URL(raw);if(!['http:','https:'].includes(url.protocol))continue;}catch(e){continue;} const a=document.createElement('a');a.href=url.href;a.target='_blank';a.rel='noopener noreferrer';a.textContent=brand;links.appendChild(a); } document.getElementById('socialFooter').hidden=PUBLIC_PAGE&&!links.children.length; if(!PUBLIC_PAGE&&!links.children.length){const note=document.createElement('p');note.className='hint';note.textContent='Add your profile URLs in Social Footer. Empty links are hidden on the public page.';links.appendChild(note);} } function galleryConfigText(){ for(const key of ['galleryRecipientEmail','gallerySenderEmail'])if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(state[key]||''))throw Error('Enter valid recipient and sender email addresses in Email Delivery.'); const site=new URL(state.gallerySiteUrl);if(!['http:','https:'].includes(site.protocol)||site.username||site.password)throw Error('Enter a valid website address.'); const settings={recipient:state.galleryRecipientEmail.trim(),sender:state.gallerySenderEmail.trim(),site_url:site.href.replace(/\/$/,''),mail_mode:'mail',storage_dir:'',max_storage_bytes:2147483648}; return 'URL.revokeObjectURL(url),3000);} function zipPixelFiles(files){ const encoder=new TextEncoder(),local=[],directory=[];let offset=0; function crc(data){let c=0xffffffff;for(const b of data){c^=b;for(let j=0;j<8;j++)c=(c>>>1)^((c&1)?0xedb88320:0);}return(c^0xffffffff)>>>0;} for(const [name,text]of Object.entries(files)){ const filename=encoder.encode(name),data=encoder.encode(text),checksum=crc(data); const h=new Uint8Array(30),v=new DataView(h.buffer);v.setUint32(0,0x04034b50,true);v.setUint16(4,20,true);v.setUint16(6,0x800,true);v.setUint16(12,33,true);v.setUint32(14,checksum,true);v.setUint32(18,data.length,true);v.setUint32(22,data.length,true);v.setUint16(26,filename.length,true);local.push(h,filename,data); const c=new Uint8Array(46),d=new DataView(c.buffer);d.setUint32(0,0x02014b50,true);d.setUint16(4,20,true);d.setUint16(6,20,true);d.setUint16(8,0x800,true);d.setUint16(14,33,true);d.setUint32(16,checksum,true);d.setUint32(20,data.length,true);d.setUint32(24,data.length,true);d.setUint16(28,filename.length,true);d.setUint32(42,offset,true);directory.push(c,filename);offset+=h.length+filename.length+data.length; } const length=directory.reduce((sum,b)=>sum+b.length,0),end=new Uint8Array(22),view=new DataView(end.buffer),count=Object.keys(files).length; view.setUint32(0,0x06054b50,true);view.setUint16(8,count,true);view.setUint16(10,count,true);view.setUint32(12,length,true);view.setUint32(16,offset,true);return new Blob([...local,...directory,end],{type:'application/zip'}); } function makeCommunityFiles(){ const seed=document.getElementById('pixelself-server-files');if(!seed)throw Error('Open the editable copy to export the full website.'); const files=JSON.parse(seed.textContent);files['pixelself-landing.html']=makePublicHTML();files['gallery-config.php']=galleryConfigText();return files; } function wireCommunityEditor(){ document.getElementById('previewSignupConfirm')?.addEventListener('click',()=>openSignupConfirmation(true)); document.getElementById('closeSignupConfirm').addEventListener('click',()=>document.getElementById('signupConfirmation').close()); document.getElementById('exportServerSettings')?.addEventListener('click',()=>{try{downloadPixelFile('gallery-config.php',galleryConfigText());}catch(e){alert(e.message);}}); document.getElementById('exportCommunity')?.addEventListener('click',()=>{try{downloadPixelFile('pixelself-community-upload.zip',zipPixelFiles(makeCommunityFiles()));}catch(e){alert(e.message);}}); document.getElementById('socialFooter').addEventListener('click',()=>focusPopupEditor('editorSocial')); } if(!PUBLIC_PAGE){setInputs();wire();wirePreviewEditorNavigator();} apply();wireSmoothSectionNavigation();officialMotionLogoRuntime();officialMotionLogoRuntime("subscriptionMarkCanvas");wireSubscriptionPopup();wireChroma();wireGallery();wirePopupEditorShortcuts();wireCommunityEditor();