Code as Visuals: How LLMs Are Reshaping Interactive Presentations

    Large language models can do more than generate static images or videos—they can produce runnable frontend programs that render interactive, cinematic presentations in the browser. This article explains the "code as intermediate representation" approach, proposes a layered reference architecture for building presentation-style applications, and covers prompt engineering, code organization, accessibility, performance budgets, and evaluation criteria so developers can turn impressive demos into repeatable engineering practice.

    From “Generating Assets” to “Generating Programs”

    For some time, the common path for generative models producing visual content has been to directly output images, videos, or audio assets. But recent discussions around “generating an interactive presentation from a single prompt” point to a direction more worth developers’ attention: instead of rendering every frame, the large language model generates a runnable frontend program. The program contains scene descriptions, timelines, transition functions, interaction states, and rendering logic, which the browser or runtime then executes.

    The value of this path is that it advances visual creation from “asset assembly” to “programmatic expression.” Traditional presentations are mostly page-based, with discrete transitions between slides; code-generated presentations can expand each page into a scene, a shot, or even an explorable virtual space. What the audience sees is no longer just static charts, but dynamic information structures that change with choices, time, and state.

    It’s worth emphasizing that what’s truly reusable from these cases is not a specific model version, but a general technical method: code as the intermediate representation, the model responsible for planning and implementation, the runtime responsible for rendering and interaction. Only by understanding this can developers turn an occasional phenomenon into a repeatable engineering practice.

    Why Code Expands Creative Boundaries

    Code is a dense, composable, and verifiable intermediate representation. Compared with generating pixels directly, code generation offers three clear advantages.

    First, composability. Visual elements such as charts, text, globes, the sun, particles, and camera movements can be abstracted into components or scene objects, combined through parameters into complex visuals. The model doesn’t need to describe pixels for every frame—only organize object relationships and temporal logic.

    Second, interactivity. Presentation content can listen for clicks, drags, scrolls, keyboard input, and other events, rearranging shots based on state changes. Interaction isn’t bolted on afterward; it’s part of the design from the code structure up.

    Third, iterability. Generated results can be read, debugged, replaced, and reused. Developers can locate a specific scene function, transition curve, or asset loading logic, rather than facing an uneditable video and regenerating from scratch.

    This also dispels a common misconception: powerful visual generation doesn’t necessarily depend on visual generation models. By writing code, an LLM can equally produce animations, 3D scenes, dynamic infographics, and complex transitions. The key is whether the model can break a narrative goal into executable modules while keeping the code structure consistent.

    Reference Architecture: Building Presentations as Applications

    To turn “generate a stunning presentation” into a stable process, a layered architecture is recommended. Here’s a neutral reference model.

    1. Requirements Parsing Layer

    Convert the natural language goal into a structured specification, including topic, number of chapters, emotional arc, interaction modes, performance budget, and fallback strategy. The model should output an outline first, not complete code.

    2. Narrative and Storyboard Layer

    Break the outline into shots or scenes, defining each scene’s entry conditions, duration, core visual objects, and transition relationships. The storyboard layer is key to controlling the “cinematic feel” and preventing every page from becoming the same layout.

    3. Scene Graph and Rendering Layer

    A scene consists of an object tree, materials, camera, lighting, and time parameters. The rendering layer should shield drawing details and provide a unified scene interface upward.

    4. Interaction and State Layer

    Define global state, selected objects, playback progress, user input, and rollback logic. Interaction state should be serializable for debugging and recovery.

    5. Timeline and Transition Layer

    Abstract animation as time functions and transitions as progress mappings from scene A to scene B. This way the model can compose effects such as fades, push-ins, camera fly-throughs, and object morphing without writing duplicate code for each transition.

    6. Assets and Runtime Layer

    Prefer code-based drawing and procedural generation to reduce dependence on external assets. For deployment, static bundles can go into object storage, accelerated via a CDN, with logging services and monitoring alerts wired in to observe runtime errors.

    A simplified type design looks like this:

    1. interface Scene {
    2. id: string;
    3. setup(runtime: Runtime): void;
    4. update(time: number, state: DemoState): void;
    5. render(runtime: Runtime): void;
    6. }
    7. interface Transition {
    8. from: string;
    9. to: string;
    10. duration: number;
    11. progress(t: number): number;
    12. }
    13. interface SlideSpec {
    14. id: string;
    15. scene: Scene;
    16. transitionIn?: Transition;
    17. transitionOut?: Transition;
    18. interactive?: boolean;
    19. }

    This abstraction doesn’t depend on any particular rendering library. The core is upgrading “pages” to “scenes,” “slide changes” to “transition functions,” and “presentations” to “applications with a timeline and state.”

    Prompt Engineering: Goals, Constraints, and Acceptance Criteria

    High-quality results rarely come from a single prompt like “make it stunning.” They come from clear goals, technical constraints, and acceptance criteria. Prompts can include four types of information.

    Goal layer: Describe the topic, audience, narrative pacing, and desired emotional arc—for example, “a future-computing themed presentation for developers, moving from calm to tense to an open ending.”

    Constraint layer: Specify the tech stack, forbid external assets, require interactivity, responsiveness, and a first-load budget. The clearer the constraints, the more controllable the generated code.

    Structure layer: Require the model to output an outline first, then scene interfaces, then implementations. Staged generation makes error correction easier than one-shot generation.

    Acceptance layer: Require self-checks for runnability, absence of blocking errors, transition continuity, keyboard operability, and mobile fallback. You can also ask the model to list known limitations after output.

    In practice, write prompts as “specification documents” rather than “inspiration descriptions.” Models excel at executing explicit constraints, but they need humans to anchor narrative taste and engineering boundaries.

    Code Organization: Data-Driven Structure and Scene Interfaces

    To keep generated results maintainable, a data-driven structure is recommended. Slide lists, scene parameters, and transition configurations belong in the data layer; rendering logic belongs in the execution layer. Adding a new page then requires no copy-pasted code.

    1. const deck: SlideSpec[] = [
    2. {
    3. id: "intro",
    4. scene: createTitleScene("Code as Visuals"),
    5. transitionOut: fade(800),
    6. interactive: false
    7. },
    8. {
    9. id: "timeline",
    10. scene: createTimelineScene(),
    11. transitionIn: cameraPush(1200),
    12. transitionOut: morph(900),
    13. interactive: true
    14. }
    15. ];

    At the same time, every scene should implement a unified interface, preventing the model from writing large numbers of coupled scripts. A unified interface also enables automated checks: iterate over scenes, call setup, update, and render, catch exceptions, and record timings.

    For transitions, pure functions are recommended. A transition takes only the progress t as input and outputs interpolation parameters, without directly modifying global state. This makes transitions easy to test and easy for the model to compose into complex shots.

    Interaction and Accessibility: Don’t Just Chase “Looking Cool”

    Interactive presentations easily devolve into visual showing off, but engineering must account for accessibility. At minimum, support keyboard navigation, visible focus, reduced-motion preferences, readable text contrast, and screen reader labels. For 3D scenes, provide static fallback frames or a simplified mode.

    Interaction state should also be predictable. Selected objects, play/pause, scene jumps, and going back should all follow an explicit state machine. A good practice is to separate user input from animation time: animation time is driven by a clock, interaction events only modify state, and the rendering layer computes the frame from state.

    Performance and Stability: Set Budgets for “Crazy Effects”

    Code-generated visual content is prone to performance problems. In practice, set budgets: first-screen object count, texture sizes, draw calls per frame, concurrent animations, and mobile fallback thresholds. The render loop should avoid creating large numbers of objects per frame, and asset loading should have failure fallbacks.

    The runtime needs error boundaries. A single scene’s failure shouldn’t blank the entire presentation. You can catch exceptions during scene transitions, show a simplified placeholder page, and log the error. For long presentations, support preloading the next scene and releasing the previous scene’s resources to avoid unbounded memory growth.

    Evaluation and Risks: From “Stunning” to Deliverable

    Evaluating code-generated presentations can’t rely on first impressions. Score them across five dimensions: narrative completeness, visual consistency, interaction usability, runtime performance, and code maintainability. Also check security and compliance risks—for example, whether the generated code makes untrusted external requests, includes unauthorized assets, or applies excessive motion that causes discomfort.

    For copyright, prefer procedural drawing and owned assets; if external resources are used, verify licensing. For accessibility, provide captions, text summaries, and static versions. For engineering, retain generation records, prompt versions, and manual modification points for traceability.

    Best Practices Checklist

    1. Have the model output the storyboard and scene interfaces before generating implementations.
    2. Describe slides and transitions with data; avoid copy-paste-style code.
    3. Implement a unified lifecycle interface for every scene to enable automated checks.
    4. Use pure functions for transitions; separate animation time from interaction state.
    5. Set performance budgets and a mobile fallback strategy.
    6. Add error boundaries, logging, and monitoring alerts to the runtime.
    7. Write accessibility into the prompt’s acceptance criteria.
    8. Review generated results for both aesthetics and engineering quality.

    Conclusion

    “Generating presentation content with code” has drawn attention not because it replaces a file format, but because it demonstrates a general paradigm for LLMs participating in complex creation: the model handles planning, decomposition, and implementation; code handles expression, composition, and execution; the runtime handles interaction and feedback. For developers, the truly reusable asset is this engineering method. Write prompts as specifications, abstract scenes as interfaces, abstract transitions as functions, and fold performance and accessibility into acceptance criteria—only then can “stunning” evolve from a lucky accident into a repeatable, deliverable capability.