A generated video feed
Updated
A script publishes a named stream with Streams.create and writes a plasma frame into it every update; the screen’s Media Stream plays it.
Watch the screen. Drag to orbit the camera, scroll to zoom.
A generated video feed
#pragma lifecycle(startup, update)
const WIDTH = 64;const HEIGHT = 36;const pixels = new Uint8ClampedArray(WIDTH * HEIGHT * 4);let feed;
function startup() { feed = Streams.create('plasma', { video: { width: WIDTH, height: HEIGHT } });}
function update(dt, time) { for (let y = 0; y < HEIGHT; y++) { for (let x = 0; x < WIDTH; x++) { const i = (y * WIDTH + x) * 4; const v = Math.sin(x * 0.2 + time) + Math.sin(y * 0.3 - time * 1.3); pixels[i] = 128 + 127 * Math.sin(v); pixels[i + 1] = 128 + 127 * Math.cos(v); pixels[i + 2] = 200; pixels[i + 3] = 255; } } feed.writeVideoFrame(pixels);}How it works
Section titled “How it works”The script is explained step by step in A generated video feed.
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.
PlasmaStream.xrproj