A slide projector
Updated
A script on a projector spot light shows the next image of a list every five seconds, waiting for each one to load.
Watch the slides change on the wall every five seconds. Drag to orbit the camera, scroll to zoom.
A slide projector
#pragma lifecycle(startup)
const SLIDES = [ '/example-assets/lemon-decal.png', '/example-assets/bang.png', '/example-assets/alpha.png',];const SECONDS_PER_SLIDE = 5;
async function startup() { const projector = self.parent.getComponent(SpotLightProjectorComponent); let index = 0;
for (;;) { projector.setProps({ src: SLIDES[index] }); await projector.load(); // show it as soon as it is ready await new Promise((done) => delay(done, SECONDS_PER_SLIDE * 1000)); // then hold it index = (index + 1) % SLIDES.length; }}How it works
Section titled “How it works”The script is explained step by step in A slide projector.
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.
SlideProjector.xrproj