Code Generation for Complex Presentations: A Technical Practice

    This article explores how code generation turns complex presentations into programmable, browser-based scenes instead of static slides. It breaks down the four capabilities required from large language models—intent understanding and structure planning, scene and camera design, programmatic visual generation, and interaction with state management—and explains why code-driven rendering can deliver strong visuals without dedicated image or video models. It also covers performance and accessibility practices, how to turn one-off demos into a repeatable engineering pipeline, and a checklist for evaluating whether a code-generated presentation is production-ready.

    1. From Slides to Programmable Scenes: A Shift in Paradigm

    The basic unit of a traditional presentation is a static page: one layout per slide, elements positioned by dragging, and animations that rely on preset templates. When the content needs to express complex system evolution, a jump in data scale, or abstract concepts, the information capacity of static pages quickly hits a ceiling.

    A recently discussed body of work redefines the presentation as a “programmable continuous scene”: a page is no longer the endpoint, but a slice of camera, space, and state. The author provides only a natural-language description of intent, an AI coding tool generates the entire codebase, and the result is an interactive presentation that runs in the browser. The whole process uses no external assets—graphics, transitions, and audio are all synthesized by code.

    The technical implication is clear: a presentation shifts from a “layout problem” to a “software engineering problem.” Once the artifact is code, it can be version-controlled, automatically tested, built on demand, and continuously integrated—a fundamental difference from manual layout work.

    2. Core Capabilities: How LLMs Perform “Visual Creation”

    To make a model output a presentation that looks complete and runs reliably, four capabilities must work together.

    2.1 Intent Understanding and Structure Planning

    The model must first turn a vague description into a structured outline: the narrative thread, chapter breaks, and the single conclusion each section must convey. This step determines whether all subsequent visual decisions have a basis. In practice, it helps to explicitly enforce “one conclusion per screen” to avoid piling up information.

    2.2 Scene and Camera Design

    Content is mapped to objects and camera paths in a virtual space, using push-in, pull-out, orbit, and focus moves instead of page flips. What matters is not the number of effects, but the correspondence between camera motion and meaning: push in to emphasize cause and effect, pull out to show the full picture.

    2.3 Code-Based Visual Generation

    All graphics, particles, terrain, lighting, and transitions are generated programmatically, and audio can also be produced with synthesis algorithms. The following is a schematic scene registration logic (structure only, not a specific product API):

    1. const scenes = [
    2. { id: 'intro', camera: { from: [0, 2, 8], to: [0, 0, 4] }, build: buildTitleScene },
    3. { id: 'growth', camera: { from: [0, 0, 4], to: [6, 3, 10] }, build: buildGrowthScene },
    4. { id: 'outro', camera: { from: [6, 3, 10], to: [0, 6, 14] }, build: buildOutroScene }
    5. ];
    6. function render(t) { // t is the global timeline
    7. const i = locateScene(t);
    8. scenes[i].build(progressOf(t, i));
    9. applyCamera(interpolate(scenes[i].camera, progressOf(t, i)));
    10. }

    2.4 Interaction and State Management

    Interactivity means the presentation is no longer a linear playback. A state machine is needed to manage the “current scene, playback progress, and user-selected object,” and to let clicks, scrolling, and keyboard input change branches. It is advisable to decouple state from rendering, so the render layer only reads state snapshots—making replay and recording easier.

    3. Why Strong Visuals Are Possible Without Visual Models

    A common misconception is that high-quality visuals must depend on dedicated image or video generation. In fact, code-based rendering has clear advantages in controllability:

    • Determinism: the same input yields the same frame, which makes regression verification easy;
    • Editability: changing one parameter adjusts the style globally, rather than regenerating everything;
    • Resolution independence: vector and procedural geometry adapt losslessly to any screen;
    • Small size: no large assets to distribute, so first-screen loading is faster;
    • Consistency: color, typography, and motion curves are constrained by unified design tokens, so the style does not drift.

    The cost is a need for stronger engineering constraints, especially performance budgets and fallback strategies.

    4. Performance and Accessibility: What Makes It Actually Usable

    The part of a complex 3D scene most likely to spiral out of control is frame rate and compatibility with low-end devices. Practical measures include:

    1. Set a frame budget: define the per-frame time limit at the target frame rate, and trigger a fallback when it is exceeded;
    2. Tiered rendering: choose shadows, particle counts, and post-processing toggles based on device capability;
    3. Resource reuse: cache and share geometries, materials, and textures to avoid repeated creation;
    4. On-demand loading: build scenes in chunks, warm them up before entry, and release them after exit;
    5. Accessibility fallback: provide a text outline, captions, keyboard navigation, and a “reduced-motion mode” that respects the system’s reduced-motion preference.
    1. const tier = detectTier(); // determined by device and measured frame time
    2. const quality = tier === 'low' ? { particles: 200, shadows: false } : { particles: 2000, shadows: true };

    5. Engineering It: Turning a One-Off Showcase into a Reusable Pipeline

    To let a team reliably produce this kind of presentation, it needs to be brought into the normal development workflow:

    • Templates and tokens: accumulate scene templates, motion curves, and color and font-size tokens;
    • Prompt and constraint docs: specify narrative structure, forbidden elements, and performance limits to reduce randomness;
    • Automated checks: verify asset size at build time, sample frame time at runtime, and compare screenshots to prevent visual regressions;
    • Delivery: host static output on object storage with a content delivery network, or package it as a single file that runs offline;
    • Observability and alerts: connect logging and monitoring services to track load failure rates and interaction anomalies.

    On the compute and cost side, long-context inference and high-resolution rendering both amplify overhead. A workable strategy is to layer them: first use a lower inference tier to produce structure and sketches, confirm the narrative, then use a higher tier to refine key scenes; also cache intermediate artifacts to avoid repeated generation. Writing budget, quota, and timeouts into the workflow constraints is key to avoiding a single task consuming most of the allocation.

    6. Evaluation Checklist: How to Judge a Code-Based Presentation

    • Narrative: does each screen carry only one conclusion, and do transitions serve the logic?
    • Visuals: is the style consistent, and is there any meaningless piling up?
    • Interaction: is state traceable, and can abnormal operations be recovered?
    • Performance: does the frame rate meet the target on target devices, and is there a fallback path?
    • Maintainability: are parameters centrally managed, and are scenes pluggable?
    • Compliance and copyright: are audio and video synthesized by code or properly licensed, avoiding external-asset risk?

    7. Conclusion

    The real value of this kind of work is not a single stunning impression, but that it validates a path: build presentations as software, and use code to express graphics, motion, sound, and interaction in a unified way. For developers and enterprise users, this means content production can enter a versioned, testable, and reusable engineering system. It is also a reminder that the stronger the capability, the more it needs boundary constraints on budget, performance, and accessibility. In the general engineering practice of cloud platforms such as Baidu AI Cloud, embedding generation capabilities into the existing development and operations pipeline is the realistic way to turn “stunning once” into “stable delivery.”