When Code Becomes the Brush: A Technical Breakdown of AI-Generated Immersive Demos
This article examines how large language models can generate interactive, immersive presentations entirely in code, without image, video, or audio assets. It breaks the approach into four layers—scene and primitives, camera orchestration, procedural audio, and interaction state—and covers prompt engineering, performance budgets, maintainability, and the practical limits of the technique. Readers will find reusable engineering patterns and code examples for turning a natural-language idea into a runnable, interactive experience.
Introduction: An Engineering Question Raised by a “Slide Deck”
A piece titled The Last Boring Slide has drawn heavy discussion in technical communities. It uses no images, video, or audio assets; every visual and sound is generated in real time by code. After the viewer clicks, the scene begins as ordinary-looking charts and text boxes, then the selected objects gradually become a globe, a star, and finally the entire frame itself. Camera movement, the 3D scene, and transitions are continuous, and the whole experience is interactive.
What deserves attention is not the piece itself but how it was produced: the creator supplied only a natural-language prompt, specified no visual style, and provided no assets. The model produced a runnable result in roughly forty-plus minutes, consuming a considerable amount of compute quota. The real technical value of this case is that it validates a long-underrated route: a large language model can produce animation, 3D scenes, dynamic infographics, and complex transitions by writing code, without relying on a visual generation model.
Setting aside the specific product, this article abstracts the phenomenon into a general engineering problem: how to build an interactive, immersive presentation system in a “code as the asset” way.
1. The Paradigm Shift: From Assembling Assets to Procedural Generation
Traditional presentation tools assume that content consists of discrete pages and that visual assets are prepared in advance by people. This creates three inherent limits: asset production and content iteration block each other; interaction is locked by the tool’s data model; and cross-device consistency depends on export formats.
Procedural generation reverses the assumption: a page is a state at runtime, a visual asset is a function output, and interaction is a state transition. The benefits and costs are clear.
- Benefits: content can be parameterized and styles swapped in bulk; interaction freedom is no longer constrained by the host tool; version control moves from “binary files” to “text code,” which can be reviewed and rolled back.
- Costs: the debugging chain gets longer, and a visual defect may be a math problem; the performance budget must be designed up front; the approach is more sensitive to the runtime environment (graphics capability, audio policy).
2. Technology Stack: Four Layers
1. Scene and Primitive Layer
Describe the scene graph declaratively, with nodes carrying transforms, materials, and visibility. The so-called “slides rewriting themselves” is essentially giving a selected object the ability to jump between levels: a rectangle can first be a chart container, then a window, then a texture carrier for a planet’s surface.
// Example: a node has two sets of attributes: "semantic identity" and "geometric identity"const node = {id: 'chart-01',semantic: 'slide-object', // office semantics: a chartgeometry: 'plane', // geometric identity: a planemorphTo: ['window', 'planet'] // allowed identity transitions};
2. Camera and Orchestration Layer
A cinematic feel comes from constraints, not freedom. A reusable approach is to define a camera state machine, abstract push, pull, pan, and orbit into parameterized tracks, and control pacing with easing functions; use a consistent interpolation strategy between keyframes to avoid “mechanical constant speed.”
const shot = {from: { radius: 6, theta: 0.2, phi: 1.1 },to: { radius: 48, theta: 1.9, phi: 0.7 },duration: 4200,easing: 'cubicInOut'};
3. Procedural Audio Layer
Without external audio files, you can synthesize music and sound effects with oscillator stacking, noise shaping, and envelope control, and let audio parameters share the same timeline as visual events. In engineering terms, you must handle browser autoplay policy: start the audio context only after the first user gesture.
// Example: drive a sound envelope from a visual eventonEvent('planet-rise', () => {ctx.resume();gain.gain.linearRampToValueAtTime(0.25, ctx.currentTime + 1.5);});
4. Interaction and State Layer
Model the presentation as a finite state machine, where each state maps to a scene configuration; interactions (click, scroll, keyboard) only trigger transitions and never manipulate the visuals directly. This naturally supports non-linear narrative and going back.
3. Prompt Engineering: Turning Aesthetic Intent into Executable Constraints
The key to the prompt in this case was not wording but that it gave the goal, the degrees of freedom, and the acceptance criteria at the same time. It can be abstracted into a four-part template:
- Theme and core: state what the narrative must argue;
- Freedom declaration: allow the model to choose the style and asset strategy on its own;
- Quality anchor: use a relative standard such as “most carefully crafted” instead of locking a specific style;
- Deliverable form: it must be runnable, interactive, and free of external dependencies.
Note that fully opening up the degrees of freedom significantly raises the failure rate. For production, add implicit constraints: target frame rate, first-screen load time, fallback strategy, and accessibility requirements.
4. Performance and Engineering Budget
The most common failure of an immersive experience is not that it looks bad but that it stutters. Write the budget in at the generation stage:
- Geometry budget: control draw calls and triangle counts, and use instancing for repeated elements;
- Pixel budget: limit real-time post-processing and high-resolution render targets, and provide quality tiers;
- Time budget: use frame time as the only metric, and automatically downgrade effects once a threshold is exceeded;
- Resource budget: zero external assets means a very small bundle, so spend the saved bandwidth on first-screen warm-up.
5. Quality Assurance and Maintainability
Maintainability of code-generated content depends on three things: determinism (the same input yields the same result, so random numbers need a fixed seed), observability (instrument keyframes and feed frame-time logs into monitoring and alerting), and rollback (keep the prompt and the generated output together in version control). For enterprise scenarios, you can combine container platforms for build isolation, distribute static output through object storage, and use a logging service to locate rendering anomalies in production.
6. Capability Boundaries and Realistic Expectations
Be objective: this approach suits short durations, strong visual impact, and limited interaction paths, such as product storytelling, technical evangelism, and teaching demos; it is not suited to very long durations, large amounts of precise data tables, or formal documents that require strict layout compliance. In addition, the first-pass success rate of generated results is significantly affected by model capability, so engineering should keep a human review and second-pass tuning step. The value of AI coding tools and large models is to compress “implementation cost” so that ideas can be tried out quickly, not to replace design judgment.
Conclusion
What this piece truly proves is that when generative capability is strong enough, code becomes a universal brush. For developers, what is worth accumulating is not a single stunning case but a reusable method: scene-graph abstraction, a camera state machine, procedural audio, interaction state management, and a performance budget. With this method, whether you rely on the general compute and engineering capabilities on Baidu AI Cloud or a local environment, you can reliably turn a natural-language idea into a runnable, interactive, and maintainable immersive experience.
