Building Dynamic Presentations with LLM Code Generation
This article examines how large language models can produce cinematic, interactive presentations by writing code instead of generating images. It covers the limits of traditional slide formats, the browser graphics stack that makes code-driven scenes possible, prompt engineering practices that steer models toward high-quality visual code, and a practical pipeline for building, validating, and deploying this kind of output as static front-end assets.
From Slides to Scenes: How Presentation Formats Evolved
A dynamic presentation generated entirely from code by a large language model recently drew wide attention in developer communities. What made it unusual: no visual design software, no imported assets. The music, animation, 3D scenes, and transitions were all implemented in code. The creator supplied a short natural-language prompt, and roughly forty minutes later the result was delivered — complete with cinematic camera work, smooth transitions, and full interactivity.
The reason this matters to developers is not the performance of one specific model. It is the technical path it reveals: a large language model’s visual output can bypass visual generation models entirely and be produced by writing code. Animation, 3D scenes, animated infographics, complex transitions — content that traditionally required specialized design tools — can now be achieved through “the model writes code, the browser renders it.”
Core Architecture: Why Code Can Carry a “Cinematic” Presentation
The Structural Limits of Traditional Slides
A traditional deck is essentially a linear collection of static pages: each page assembled from text, charts, and images, with animation used only as decoration between page changes. Technically this is equivalent to playing back a sequence of pre-rendered bitmap or vector pages, and both information density and visual expressiveness have a hard ceiling.
The Code-Driven Format
In a code-driven approach, every “page” can be redefined:
- A scene: the page is no longer a fixed layout but a 3D space the camera can travel through.
- A shot: a transition is no longer a simple fade but a continuous animation with camera logic.
- An interaction container: the audience can drag, zoom, and trigger state changes, turning the presentation from “playback” into “exploration.”
What supports all of this is the complete graphics capability stack that modern browsers provide. A typical 3D scene has roughly this code structure:
// Scene manager: define each page as an independent sceneclass SceneManager {constructor() {this.scenes = new Map();this.current = null;}register(name, sceneFactory) {this.scenes.set(name, sceneFactory);}async transitionTo(name, transition) {const next = this.scenes.get(name)();await transition(this.current, next); // run the camera-style transitionthis.current = next;}}// Page content shifts from "static elements" to "timeline animation"page.timeline.from('.title', { y: 40, opacity: 0, duration: 0.8 }).to('.camera', { fov: 55, duration: 2 }, '<0.2').add(() => expandEarthScene()); // a chart element "becomes" a 3D globe
The key to this architecture is consistency of visual symbols. The effect in strong examples — a selected object turning from a chart into a globe and then into the entire frame — is fundamentally a combination of coordinate-system transformation and object replacement animation. The visual language of office software (selection boxes, cursors, legends) becomes the narrative thread linking heterogeneous scenes, so the whole piece keeps the metaphor of “a slide rewriting itself.”
Prompt Engineering: Steering the Model Toward High-Quality Visual Code
The prompt used in the original work is worth studying. It contains several elements with a large effect on the result, which can be abstracted into a general methodology.
Fix the Topic, Leave the Style Open
The prompt locked in only the topic — the future of AI — and deliberately specified no visual style and supplied no assets. This looks risky but is the key strategy: a human-anchored style limits the model’s exploration space, while the absence of anchoring bias lets the model choose the most expressive technical combination on its own (WebGL, Canvas, SVG, Web Audio, and so on).
Set Quality Expectations Rather Than Specific Requirements
The prompt used a goal-level constraint — something like “I hope you produce the most carefully crafted, most stunning presentation possible” — instead of a checklist-level constraint such as “include transition animations and a 3D scene.” Experiments suggest that for open-ended creative tasks, goal-level constraints paired with an expression of trust (“I believe you are capable of this”) tend to trigger longer reasoning chains and more self-correction iterations from the model.
Give Enough Iteration Budget
Output for this kind of task is usually thousands of lines of structured code, and inference cost is significantly higher than for ordinary question answering. In practice:
- Use a higher reasoning tier so the model can plan thoroughly before generating.
- Reserve budget for multiple rounds of correction; after the first pass, tune transitions, timing, and performance item by item.
- Split large tasks into staged phases — “scene skeleton → per-scene animation → global transitions → audio integration” — to reduce the complexity of each single generation.
Engineering Practice: Building Your Own Code-Generated Presentation Pipeline
Developers who want to reproduce this kind of result can follow the technical route below.
Choosing the Stack
| Layer | Recommended option | Notes |
|---|---|---|
| 3D rendering | WebGL wrapper library | Quickly build 3D scenes with camera movement |
| Timeline animation | Declarative animation library | Choreograph multi-element animation with timeline syntax |
| Audio generation | Web Audio API | Synthesize background music and sound effects purely in code |
| Interaction state | Finite state machine | Manage page changes and user input |
| Hosting | Static asset hosting service | Front-end-only output; object storage plus CDN is enough to distribute |
Because the final artifact is pure front-end static code, deployment cost is very low: upload the build output to object storage, attach a CDN-accelerated domain, and you have a presentation page reachable globally. If you need to collect audience interaction data, you can combine cloud logging services with a message queue for asynchronous event tracking and analysis.
A Workflow for Working with AI Coding Tools
Taking the intelligent coding capabilities of platforms such as Baidu AI Cloud’s Qianfan model platform as an example, a typical workflow has four steps:
- Intent modeling: describe the narrative structure of the presentation in natural language (number of pages, emotional curve, climax points).
- Skeleton generation: have the model first generate the code framework for the scene manager and page routing.
- Per-scene deepening: generate animation code for each scene separately, verifying the visual result with screenshots or screen recordings.
- Integration and tuning: merge the transition logic, compress resources, and check frame rate with the browser performance panel.
# Typical staged prompting strategy# Round 1: generate the project skeleton"Generate a single-page presentation framework with scene management, routing, and transition interfaces"# Round 2: fill in scenes one by one"Implement page 3: an animation where a bar chart gradually morphs into a rotating globe"# Round 3: global polish"Add a unified camera-style transition to all pages, keeping the pacing under 1.2s"
Quality Checklist
- Frame rate discipline: for complex 3D scenes, merge draw calls and avoid creating objects every frame.
- Fallback strategy: provide a CSS animation fallback for environments that do not support WebGL.
- Maintainability: require the model to output modular, commented code rather than one giant file.
- Asset closure: stick to the “zero external assets” principle and draw every visual element in code, so the artifact is self-contained and runs offline.
Trends and Conclusion
The popularity of this kind of work signals two things.
First, a large language model’s “taste” is becoming a usable capability. When a model can make high-quality visual decisions on its own without assets or a style anchor, the division of labor between human and machine shifts from “the human gives instructions and the machine executes” to “the human sets the goal and the machine creates.”
Second, code is the ultimate general-purpose form. Compared with dedicated visual generation models, code-generated artifacts are inherently interactive, editable, and deployable. For developers, mastering the chain of “prompt engineering + front-end graphics + cloud deployment” means owning a complete method for turning a large model’s creativity into a deliverable product quickly.
Next time you need a presentation that commands the room, try letting the model write the code directly — what you get may be more than a slide deck, but a virtual space people can explore.
