Switch a retro screen on and off
Updated
Pixelation, Scanline and Noise effects on the camera make the scene look like an old monitor; pressing Space tweens all three in or out together.
Click the scene, then press Space to fade between the retro look and the clean picture. Drag to orbit the camera, scroll to zoom.
Switch a retro screen on and off
#pragma lifecycle(startup, update)
let pixels;let lines;let grain;let retro = true;let fade = null;
function setRetro(amount) { pixels.setProps({ granularity: Math.max(1, Math.round(amount * 8)) }); lines.setProps({ intensity: amount * 0.3 }); grain.setProps({ intensity: amount * 0.08 });}
function startup() { const eye = findEntity('Main Camera'); pixels = eye.getComponent(PixelationEffectComponent); lines = eye.getComponent(ScanlineEffectComponent); grain = eye.getComponent(NoiseEffectComponent); setRetro(1); log('Retro screen on');}
function update() { if (!Input.keyboard.isKeyReleased(Key.Space)) return; retro = !retro; if (fade) fade.stop(); fade = Tween.value(retro ? 0 : 1, retro ? 1 : 0, setRetro, { duration: 0.6, ease: Ease.InOutQuad }); log(retro ? 'Retro screen on' : 'Clean picture');}How it works
Section titled “How it works”The script is explained step by step in Switch a retro screen on and off.
Open it in XR Creator
Section titled “Open it in XR Creator”Download the project file below, then import it in XR Hub with Projects › New › Import, as described in Projects and templates. It opens in XR Creator with the same scene you see running above, each script already attached to its Behavior entity. From there you can edit the scripts, adjust components and their props, preview your changes, and deploy the result as a world of your own.
RetroScreen.xrproj