Code Generation as a Visual Narrative Engine: How LLMs Render Presentations, Animations, and 3D Scenes
This article explains a shift in how large language models produce visual content: instead of outputting finished media, the model writes executable rendering code that a browser or runtime draws in real time. It covers why this approach makes visual output editable, composable, and auditable; how code-driven presentations differ from template-based generators; the four-layer architecture of scene, timeline, resource, and interaction; techniques for long-scroll narratives, hand-drawn style animation, and lightweight 3D scenes; and the performance and engineering constraints needed for stable delivery on low-end and mobile devices. A reusable four-step practice path is included for teams building a controllable visual content pipeline.
1. The Technical Shift: From Generating Content to Generating a Rendering Program
A recent wave of projects in overseas AI communities has drawn unusual attention: a presentation that passed seven million views and nearly thirty thousand likes, a sixty-second hand-drawn style animation, and a polished 3D mini-game scene. The counterintuitive part is that the large language models behind these works cannot output video frames directly. Every character, scene transition, camera move, and background track comes from code the model wrote, rendered live by a browser or runtime.
That distinction is the key to the whole trend. The traditional content generation paradigm has the model produce a finished artifact, such as a video clip or an image. What happens here is a paradigm shift: the model produces an executable rendering program, and the final frames are computed at runtime. In engineering terms, the output is no longer pixels but a code project containing a scene graph, a timeline, a resource manifest, and interaction logic.
The shift has three immediate consequences:
- Editability: every element on screen is a programmable object, so changing one parameter re-arranges the whole composition instead of triggering a regeneration.
- Composability: geometry, materials, lighting, and audio can be swapped in layers, which makes it easy to produce style variants in batches.
- Auditability: the code is the process, so a developer can tell whether a problem sits in layout, timing, or resource loading rather than debugging a black-box artifact.
2. How This Differs from Conventional AI Presentation Tools
Automatic presentation generation has been fairly common for the past two years, but most solutions are content filling plus template application: the model writes copy and bullet points, the layout comes from a preset theme, and the output is still a static page. The ceiling is set by the template.
A code-driven approach treats the presentation as a front-end application. One widely discussed example is essentially a web page of roughly five megabytes containing thirteen scenes. It renders live on open: 2D charts gain spatial depth as the camera pushes in, and page turns become cinematic transitions. The technical dividing line is where complexity lives. In the template approach, complexity is absorbed in advance by the designer; in the code approach, complexity is computed on demand at runtime.
Such a system typically has four layers:
- Scene layer: a scene graph organizes elements, and each scene declares its camera, lighting, layout, and entrance animation.
- Timeline layer: a single clock drives all animation so pacing stays consistent across scenes.
- Resource layer: fonts, textures, and audio load on demand to keep the initial payload small.
- Interaction layer: keyboard, scroll, and click events map to scene jumps and parameter changes.
A schematic scene declaration looks like this. The point is to turn visual intent into structured configuration rather than hard-coded per-frame coordinates:
const scenes = [{id: 'cover',camera: { position: [0, 1.2, 6], fov: 45 },duration: 4000,enter: { type: 'fade', easing: 'easeOutCubic' },layers: ['title', 'grid']},{id: 'chart-3d',camera: { position: [0, 2.4, 8], fov: 50 },duration: 6000,transition: { type: 'dolly', overlap: 800 },layers: ['bars', 'axis', 'labels']}];function renderAt(t) {const scene = pickScene(scenes, t);const local = (t - scene.start) % scene.duration;scene.layers.forEach(name => updateLayer(name, local, scene));renderer.draw(scene.camera);}
3. The Dynamic Scroll: Turning Discrete Information into Continuous Narrative
Another group of projects renders the history of human civilization as a dynamic scroll: the frame keeps evolving as time advances, and events that would otherwise sit on separate pages become one continuous visual narrative. The hard part is not the beauty of any single frame but long-horizon state management.
A workable structure has three layers: a data layer holding timestamped event sequences, a direction layer that maps events to camera paths and element lifecycles, and a rendering layer that handles culling and scheduling. Because the scroll spans a long period, time-window culling is mandatory: render only the elements near the current viewport, or the growing element count will quickly drag down the frame rate.
function buildTimeline(events) {return events.sort((a, b) => a.t - b.t).map(e => ({ at: e.t, apply: e.apply, ttl: e.ttl ?? 3000 }));}function tick(timeline, now, viewWindow) {for (const item of timeline) {if (item.at > now + viewWindow) break;if (now - item.at > item.ttl) continue;item.apply(now - item.at);}}
4. Implementation Notes for Hand-Drawn Animation and 3D Mini-Scenes
The sixty-second hand-drawn animation is essentially non-photorealistic rendering simulated in code: noise perturbs the lines, keyframes are jittered, and paper texture plus a slight color shift are layered on so that clean geometry carries the imperfection of hand drawing. Compared with frame-by-frame drawing, the code approach makes the style parametric: line jitter amplitude and paper grain intensity are variables that can be tuned uniformly.
The 3D mini-scene depends more on resource discipline: control draw batches, reuse geometry and materials, merge static parts, and avoid creating objects every frame. Audio is usually synthesized in code or triggered precisely against the timeline, sharing the same clock as the visuals to prevent audio-video drift.
5. Stability Design Under Compute and Engineering Constraints
These applications are not forgiving about their runtime environment, especially on low-end devices and mobile. At minimum, apply the following constraints:
- Payload budget: cap the entry file size, lazy-load resources, and defer anything below the first screen.
- Frame budget: advance logic in fixed steps and decouple rendering from logic so a dropped frame cannot corrupt the timeline.
- Degradation strategy: detect device capability, automatically disable expensive effects, and preserve narrative completeness.
- Observability: instrument load time, frame rate, and errors so it is clear whether a problem is in resources or logic.
Productizing this capability usually also requires general cloud services: object storage for static asset delivery, a content delivery network to cut first-screen latency, a container platform for build and preview environments, and logging plus monitoring and alerting to track online frame rate and error rate. These are standard industry categories, and the specific choices should be evaluated against business scale.
6. A Reusable Practice Path
The practical advice for developers comes down to four steps:
- Structure the intent first: have the model output a scene list and configuration rather than large blocks of drawing code, which makes validation and incremental edits easier.
- Generate in layers: produce layout, animation, and resources separately and verify each layer, lowering the chance of a single-shot failure.
- Render deterministically: fix the time step and random seed so the same code produces the same result across runs, which makes regression testing practical.
- Keep a human on aesthetics: models are good at structure and composition, but aesthetic judgment still needs a human sign-off, particularly for brand and release scenarios.
7. Conclusion
The real signal in these projects is not that models can now make animations. It is that code has become the intermediate language through which large models express visual intent. Presentations, information scrolls, and stylized animation all fall under one engineering paradigm: the model handles direction, the runtime handles rendering, and the developer handles constraints and acceptance. For a team, the worthwhile investment is not chasing a specific tool but building a controllable, testable, and reusable visual content production pipeline. That is the core lesson this wave of technical demos leaves for engineering practice.
