How to Systematically Evaluate AI Coding Models on Web Animation Reproduction

    This article presents a structured evaluation framework for AI coding models on complex web animation reproduction. It defines success across visual structure, animation continuity, and interaction behavior; explains the core mechanics of particle interpolation and scroll-driven rendering; outlines how to inspect a target page; proposes scoring dimensions such as requirement understanding, tool use, technical selection, visual fidelity, debugging, and code quality; and reviews common failure modes and practical improvements.

    1. Background: From “Writing Code” to “Reproducing a Web Page”

    In recent years, AI coding models have evolved from simple code completion toward page generation, project modification, browser operation, and multi-turn debugging. For developers, the real value is not whether a model can output a plausible-looking block of code. The more important question is whether it can understand the visual structure and interaction rules of a real web page and ultimately deliver a complete, independently runnable result that closely matches the target page.

    “Reproducing a complex web animation” is a representative test task.

    This type of task usually includes the following requirements:

    1. The page needs a clear visual subject.
    2. The animation needs to change with scroll position.
    3. Mouse movement, hover, or click needs to produce feedback.
    4. Particles need to transition smoothly between gathering, scattering, and scene changes.
    5. The final result should be able to run independently from the original site.
    6. The code structure should be maintainable rather than a one-off visual imitation.

    Therefore, this kind of task tests more than a single code-generation capability. It examines a combination of requirement analysis, web page observation, graphics computation, front-end engineering, and debugging verification.

    2. How to Define “Successful Reproduction”

    Before evaluating model performance, it is necessary to clarify that “exactly the same” is not an easy engineering goal to verify. Visual effects are affected by browser engines, screen sizes, font rendering, device performance, and resource loading timing. Judging only by subjective impression can easily lead to unstable conclusions.

    A more reasonable approach is to break the reproduction goal into multiple layers.

    2.1 Visual Structure Restoration

    Visual structure includes the first-screen composition, main graphics, color distribution, particle density, background effects, and spatial hierarchy. For example, a page may show a complete logo in its initial state, gradually split it into a large number of glowing particles after scrolling, and then reassemble those particles into another pattern at a new position.

    At this layer, the main question is whether the model has captured the core visual language of the original page, rather than simply placing a few dots or using a preset animation instead of the real effect.

    2.2 Animation Process Restoration

    Animation cannot be judged only by its start and end frames. The intermediate states also need to be observed for naturalness. Key points include:

    • Whether particles move along reasonable paths;
    • Whether the speed of gathering and scattering matches visual expectations;
    • Whether the easing process is continuous;
    • Whether jumps appear during rapid scrolling;
    • Whether the animation has obvious stuttering, flickering, or clipping;
    • Whether there are clear state transitions between different stages.

    If a model only implements “switch to another image after scrolling,” the page may appear to have interaction, but it has not truly reproduced a particle transition.

    2.3 Interaction Behavior Restoration

    Mouse movement usually affects particle direction, speed, distance, or opacity. A strong implementation should have predictable interaction logic. For example, particles may be repelled when the mouse approaches and gradually return to their original trajectories after the mouse leaves. When scrolling stops, the animation should also settle smoothly at the corresponding progress point.

    Mobile adaptation should also be observed. Touch devices have no mouse pointer. Whether the model can provide a fallback, such as using touch position, autoplay, or retaining only scroll-driven effects, is also part of engineering completeness.

    3. Basic Implementation Principles of Complex Particle Animations

    This type of effect can usually be abstracted as “a particle set interpolating between multiple target states.”

    Assume there is a particle set on the page:

    1. P = {p1, p2, p3, ... pn}

    Each particle contains attributes such as position, velocity, opacity, size, and color. To make particles transform between different shapes, multiple target point sets can be prepared in advance:

    1. S0: initial shape
    2. S1: scattered state
    3. S2: intermediate shape
    4. S3: final shape

    At a given moment, particle positions are calculated based on the scroll progress t:

    1. position = interpolate(source, target, t)

    The simplest linear interpolation is:

    1. x = x0 + (x1 - x0) * t
    2. y = y0 + (y1 - y0) * t

    However, direct linear movement often looks mechanical. Practical implementations generally add easing functions, for example to make motion slow down gradually at the beginning and end:

    1. smoothT = t * t * (3 - 2 * t)

    For pages with a large number of particles, particle matching also needs to be considered. If two shapes have different numbers of points, the following approaches can be used:

    • Resample the target shape so that both point sets have the same count;
    • Duplicate or interpolate points when there are not enough;
    • Reduce opacity for excess points;
    • Find the nearest matching points based on spatial distance;
    • Use random perturbation to avoid all particles moving in sync and creating a mechanical feel.

    This part is key to distinguishing “genuine understanding of shape animation” from “applying a template.”

    4. Engineering Design for Scroll-Driven Animation

    The core of scroll-driven effects is mapping page scroll distance to an animation timeline.

    A common approach is to set a tall scroll container on the page, keep the animation area fixed within the viewport, and then update particle states according to scroll progress. The basic calculation logic is as follows:

    1. progress = (scrollTop - start) / (end - start)
    2. progress = clamp(progress, 0, 1)

    Here, start and end represent the animation start and end positions, and clamp limits the progress range.

    To avoid triggering scroll events too frequently, large amounts of drawing work should not usually be performed directly in every scroll callback. A more robust approach is:

    1. Use the scroll event only to record the latest progress.
    2. Use an animation frame callback to update the visual state in a unified way.
    3. Calculate particle positions in each frame.
    4. Consolidate drawing operations into the same render loop.

    Pseudocode:

    1. let targetProgress = 0;
    2. let currentProgress = 0;
    3. function onScroll() {
    4. targetProgress = calculateProgress();
    5. }
    6. function render() {
    7. currentProgress += (targetProgress - currentProgress) * 0.12;
    8. updateParticles(currentProgress);
    9. drawParticles();
    10. requestAnimationFrame(render);
    11. }

    This design decouples scroll changes from visual animation. Even if the user scrolls quickly, particles do not jump instantly to the target position. Instead, they complete the transition through smooth tracking.

    5. Mouse Interaction Should Not Be Just Simple Displacement

    A common mistake in mouse interaction is to detect the pointer position and directly apply a fixed offset to all particles. This is easy to implement, but it lacks spatial relationships and usually produces unnatural results.

    A more reasonable solution is to calculate the distance between each particle and the pointer and determine the influence strength based on that distance:

    1. distance = sqrt((x - mouseX)^2 + (y - mouseY)^2)
    2. force = max(0, 1 - distance / radius)

    When a particle enters the influence radius, it can be affected by repulsion, attraction, or tangential force. The direction of repulsion is usually from the pointer toward the particle:

    1. dx = x - mouseX
    2. dy = y - mouseY
    3. length = sqrt(dx * dx + dy * dy)
    4. vx += dx / length * force
    5. vy += dy / length * force

    To prevent particles from being permanently pushed away, damping and return forces are also needed. Damping suppresses velocity, while the return force gradually brings particles back to their target positions. Only then can the natural effect of “being disturbed by the mouse and then recovering” be achieved.

    6. How to Observe and Analyze the Target Page

    In practical evaluation, whether a model can correctly analyze the page is more important than whether it can write a certain piece of code. A complete observation process usually includes the following steps.

    Step 1: Record Page States

    Observe the initial page state, intermediate states during scrolling, and the end state separately. Record the time order of shape changes, particle movement directions, and differences between regions.

    Step 2: Identify the Rendering Method

    A page may be implemented with 2D canvas, 3D rendering, vector graphics, or combinations of ordinary elements. The model needs to make judgments based on page structure, resource loading methods, and runtime behavior rather than blindly choosing a technical solution.

    Step 3: Confirm Animation Trigger Conditions

    It is necessary to distinguish whether the animation is driven by scroll position, scroll velocity, mouse position, a timeline, or multiple factors together. Different trigger methods directly affect the reproduction approach.

    Step 4: Build Replaceable Target Data

    If the original page’s particle data cannot be obtained directly, target point sets can be generated through screenshot sampling, edge detection, or manual drawing. The key is to separate shape data from rendering logic so that later adjustments are easier.

    Step 5: Iteratively Calibrate with Screenshots

    The first page generated by a model usually does not fully match expectations. The target screenshot and the reproduced screenshot should be compared, and particle count, shape proportions, color, speed, easing, and interaction radius should be corrected item by item rather than changing code based only on impression.

    7. What Capabilities Should Be Considered When Evaluating AI Coding Models?

    For this type of task, a relatively complete scoring framework can be established.

    7.1 Requirement Understanding

    Does the model accurately identify the core effect on the page? Does it proactively clarify requirements such as independent operation, interaction methods, responsive layout, and compatibility?

    7.2 Tool Use

    Can the model reasonably use a browser to observe the page, read necessary resources, capture key states, and verify results? Tool use should not be a formal visit only; it should produce actual analytical conclusions.

    7.3 Technical Selection

    For effects with a small number of particles, 2D canvas may be sufficient. For complex spatial motion, a more suitable rendering approach may be needed. The model should choose technology based on task scale rather than unconditionally stacking complex dependencies.

    7.4 Visual Fidelity

    Focus on shape contours, particle distribution, motion trajectories, and color hierarchy. Visual similarity should be judged across multiple points in time rather than only from the static first screen.

    7.5 Debugging and Repair

    When the page stutters, particles go out of bounds, scrolling fails, or mobile layout becomes abnormal, whether the model can locate the cause and make targeted fixes is an important indicator of its engineering capability.

    7.6 Code Engineering Quality

    An independent demo page should have a clear directory structure, reasonable function separation, necessary comments, and configurable parameters. Particle data, interaction parameters, and rendering logic should preferably be separated for easier manual maintenance.

    8. Common Failure Modes and Improvement Suggestions

    The first failure mode is implementing only a “visual placeholder.” The page has a background, a title, and some moving dots, but the target graphics are not truly reproduced. The improvement is to extract shape contours first, then design the point sets and state transitions.

    The second failure mode is treating scroll events as animation playback. When the user scrolls quickly, the animation jumps or even enters an incorrect state. A smooth tracking mechanism that separates target progress from current progress should be used.

    The third failure mode is excessive reliance on external resources. If the page must be online to run, it does not meet the independent demo requirement. A better approach is to organize necessary styles, scripts, and shape data locally and provide fallback handling for missing resources.

    The fourth failure mode is validating only static screenshots. Many problems appear only during continuous scrolling, rapid mouse movement, or window resizing. Therefore, testing must cover normal operation, extreme operation, and mobile scenarios.

    9. Conclusion: The Real Evaluation Focus Is Closed-Loop Capability

    Evaluating an AI coding model should not depend only on whether the generated code is long or whether the first screen “looks similar.” More importantly, can it complete the full loop from observation, understanding, design, and implementation to verification and repair?

    Complex web animation reproduction is representative because it involves visual analysis, mathematical interpolation, event handling, graphics rendering, performance optimization, and engineering delivery at the same time. A strong model should be able to:

    • Accurately break down the page goals;
    • Choose an appropriate rendering technology;
    • Convert scroll and mouse input into stable animation states;
    • Express continuous shape changes through a particle system;
    • Remain basically usable across different devices and browser environments;
    • Continuously correct the implementation based on screenshots and runtime results.

    Therefore, rather than simply comparing which model “writes more code,” it is better to establish a unified task, a unified environment, and unified acceptance criteria. The focus should be on whether the model can deliver a complete technical result that is runnable, explainable, maintainable, and close to the target effect. This evaluation method is also closer to real development scenarios and can more accurately reflect how much AI coding tools actually help with front-end engineering work.