AI Code Generation Evaluation: Building a Christmas Landing Page

    This article presents a reproducible framework for evaluating AI-generated frontend code through a Christmas greeting landing page. It explains how to standardize prompts, anonymize participating models, define measurable acceptance criteria, isolate execution environments, and assess runtime behavior, visual fidelity, animation performance, responsiveness, and code quality. A complete single-file HTML reference implementation is also provided.

    AI Code Generation Evaluation: Building a Christmas Landing Page

    A holiday-themed landing page may look simple, but it tests several engineering capabilities at once: requirement understanding, visual implementation, animation performance, responsive design, and code that runs without modification.

    Rather than asking which model is “the most powerful,” a more reliable approach is to standardize the task, anonymize the participating models, and quantify the acceptance criteria. This allows different models to solve the same engineering problem under identical conditions.

    Using a Christmas greeting landing page as an example, this article presents a reusable evaluation methodology and a reference implementation.

    1. Evaluation Objectives and Principles

    Neutrality and reproducibility

    Participating models should be anonymized as Model A, Model B, and Model C. The evaluation should record only the generated results and should not promote or describe specific products during the process.

    All models should be accessed through the same intelligent coding tool and model service interface. The prompt must remain identical for every model. A one-shot evaluation should be used, without follow-up questions or iterative clarification.

    Verifiable specifications

    The task specification should include the required technology stack, visual parameters, animation behavior, performance constraints, responsive rules, and output format. Without these details, scoring can easily become a subjective judgment of visual appeal.

    Observable results

    In addition to manual scoring, the evaluation should record objective indicators, including:

    • Whether the generated code runs directly
    • Whether external dependencies are introduced
    • The number of animated elements
    • Whether layout instability occurs
    • Whether the page overflows on mobile devices

    Isolated environments

    If evaluation tasks need to be managed in the cloud, general-purpose capabilities such as containers, object storage, and logging services provided by Baidu AI Cloud can be used to isolate runtime environments and store generated artifacts and evaluation logs.

    This does not affect the model neutrality of the evaluation itself.

    2. Task Design: From a Basic Landing Page to a Composite Scenario

    The original evaluation plan can be divided into three levels:

    1. Basic frontend generation
    2. Physics engine implementation
    3. Scientific visualization

    This article focuses on the first level: a Christmas greeting landing page. The task covers the following capabilities:

    • Organizing a single-file HTML application
    • Drawing complex shapes with CSS
    • Coordinating CSS Animation with requestAnimationFrame
    • Applying performance optimizations, especially using transform to avoid layout recalculation
    • Handling responsive behavior on mobile devices
    • Following an explicit technical specification

    A qualified implementation should meet the following requirements:

    • Pure frontend implementation
    • A single HTML file
    • Inline CSS and JavaScript
    • No external libraries, fonts, or resources
    • A dark blue gradient background
    • Fifty randomly sized snowflakes that fall at a constant speed with slight horizontal movement
    • A glowing gold headline
    • A Christmas tree made from three stacked triangular layers and a brown trunk
    • Eight to ten red, green, and gold lights with staggered blinking cycles
    • A smaller headline and proportionally scaled tree on mobile devices

    3. Example Standardized Prompt

    1. Task: Build a holiday greeting landing page
    2. Technology requirements:
    3. - Use a pure frontend implementation in a single HTML file
    4. - Include inline CSS and JavaScript
    5. - Use CSS Animation and requestAnimationFrame for animations
    6. - Do not use external libraries, fonts, or resources
    7. Visual specifications:
    8. - Background: dark blue gradient (#0a1628 → #1a365d)
    9. - Snowflakes: 50 white circles, randomly sized between 2px and 5px, falling at a constant speed with slight horizontal movement
    10. - Main heading: “Merry Christmas 2025”
    11. - Use a system serif font stack
    12. - Heading color: #FFD700
    13. - Add a glowing text-shadow effect
    14. - Christmas tree: draw it using pure CSS with three stacked triangular layers and a brown rectangular trunk
    15. - String lights: add 8–10 small red, green, and gold circles to the tree
    16. - Lights should blink with opacity animations using staggered cycles
    17. Performance requirements:
    18. - Animate snowflakes with transform rather than top or left to avoid layout recalculation
    19. - Keep the total number of animated elements under control to maintain smooth 60fps performance
    20. Responsive requirements:
    21. - Reduce the heading size on mobile devices
    22. - Scale the Christmas tree proportionally on mobile devices
    23. Output the complete, runnable HTML code.

    4. Reference Implementation and Key Techniques

    The following is a runnable single-file implementation. Each snowflake uses a two-layer structure: the outer layer handles vertical movement, while the inner layer creates horizontal movement. All movement is performed with transform.

    The lights use CSS custom properties to control their colors, animation durations, and delays. requestAnimationFrame is used after the DOM has been generated to initialize the page state and avoid visual flashing during startup.

    1. <!DOCTYPE html>
    2. <html lang="en">
    3. <head>
    4. <meta charset="UTF-8">
    5. <meta name="viewport" content="width=device-width,initial-scale=1">
    6. <title>Holiday Greeting Landing Page</title>
    7. <style>
    8. :root{--bg1:#0a1628;--bg2:#1a365d;--gold:#FFD700}
    9. *{box-sizing:border-box}
    10. html,body{height:100%;margin:0;overflow:hidden}
    11. body{
    12. background:linear-gradient(160deg,var(--bg1),var(--bg2));
    13. font-family:Georgia,'Times New Roman',serif;
    14. color:#fff;display:grid;place-items:center;min-height:100vh;position:relative;
    15. }
    16. .scene{
    17. position:relative;width:min(92vw,720px);height:min(88vh,760px);
    18. display:flex;flex-direction:column;align-items:center;justify-content:flex-end;
    19. padding-bottom:8vh;
    20. }
    21. h1{
    22. margin:0 0 2rem;font-size:clamp(1.8rem,6vw,4rem);color:var(--gold);
    23. text-align:center;letter-spacing:.04em;z-index:2;
    24. text-shadow:0 0 12px rgba(255,215,0,.75),0 0 28px rgba(255,215,0,.35);
    25. }
    26. .tree-wrap{
    27. position:relative;width:min(70vw,360px);aspect-ratio:1/1.25;
    28. transform-origin:bottom center;z-index:1;
    29. }
    30. .tree{position:absolute;inset:0}
    31. .layer{
    32. position:absolute;left:50%;transform:translateX(-50%);
    33. background:linear-gradient(145deg,#0f7a3d,#064d28);
    34. clip-path:polygon(50% 0,100% 100%,0 100%);
    35. filter:drop-shadow(0 8px 14px rgba(0,0,0,.35));
    36. }
    37. .layer.l1{top:0;height:42%;width:74%}
    38. .layer.l2{top:24%;height:40%;width:88%}
    39. .layer.l3{top:48%;height:40%;width:100%}
    40. .trunk{
    41. position:absolute;left:50%;bottom:0;transform:translateX(-50%);
    42. width:16%;height:18%;z-index:0;border-radius:4px 4px 0 0;
    43. background:linear-gradient(90deg,#5b3418,#8a4b22,#5b3418);
    44. }
    45. .bulbs{position:absolute;inset:0;z-index:3;pointer-events:none}
    46. .bulb{
    47. position:absolute;width:8px;height:8px;border-radius:50%;
    48. background:var(--c);box-shadow:0 0 8px var(--c),0 0 16px var(--c);
    49. opacity:.25;animation:blink var(--d) ease-in-out infinite alternate;
    50. animation-delay:var(--delay);
    51. }
    52. @keyframes blink{
    53. from{opacity:.2;transform:scale(.85)}
    54. to{opacity:1;transform:scale(1.15)}
    55. }
    56. .snow-field{position:fixed;inset:0;pointer-events:none;overflow:hidden;z-index:0}
    57. .snow{
    58. position:absolute;top:-12px;left:var(--x);width:var(--s);height:var(--s);
    59. animation:fall var(--dur) linear infinite;animation-delay:var(--delay);
    60. }
    61. .snow b{
    62. display:block;width:100%;height:100%;border-radius:50%;
    63. background:#fff;opacity:.85;
    64. animation:sway var(--sway-dur) ease-in-out infinite alternate;
    65. }
    66. @keyframes fall{to{transform:translate3d(0,110vh,0)}}
    67. @keyframes sway{
    68. from{transform:translate3d(-6px,0,0)}
    69. to{transform:translate3d(6px,0,0)}
    70. }
    71. @media (max-width:600px){
    72. .scene{height:82vh;padding-bottom:12vh}
    73. h1{font-size:clamp(1.5rem,8vw,2.4rem)}
    74. .tree-wrap{width:min(78vw,300px)}
    75. }
    76. @media (prefers-reduced-motion: reduce){
    77. .snow,.bulb,.snow b{animation:none}
    78. .bulb{opacity:1}
    79. }
    80. </style>
    81. </head>
    82. <body>
    83. <div class="snow-field" id="snowField"></div>
    84. <main class="scene">
    85. <h1>Merry Christmas 2025</h1>
    86. <div class="tree-wrap" aria-label="A CSS-drawn Christmas tree">
    87. <div class="tree">
    88. <div class="trunk"></div>
    89. <div class="layer l1"></div>
    90. <div class="layer l2"></div>
    91. <div class="layer l3"></div>
    92. <div class="bulbs" id="bulbs"></div>
    93. </div>
    94. </div>
    95. </main>
    96. <script>
    97. const snowField = document.getElementById('snowField');
    98. const frag = document.createDocumentFragment();
    99. for (let i = 0; i < 50; i++) {
    100. const s = document.createElement('span');
    101. s.className = 'snow';
    102. const size = (Math.random() * 3 + 2).toFixed(2);
    103. s.style.setProperty('--x', (Math.random() * 100).toFixed(2) + 'vw');
    104. s.style.setProperty('--s', size + 'px');
    105. s.style.setProperty('--dur', (6 + Math.random() * 8).toFixed(2) + 's');
    106. s.style.setProperty('--delay', (-Math.random() * 12).toFixed(2) + 's');
    107. s.style.setProperty('--sway-dur', (1.8 + Math.random() * 2.4).toFixed(2) + 's');
    108. s.appendChild(document.createElement('b'));
    109. frag.appendChild(s);
    110. }
    111. snowField.appendChild(frag);
    112. const bulbs = document.getElementById('bulbs');
    113. const colors = ['#ff3b30', '#2ecc71', '#FFD700'];
    114. const points = [
    115. [50,10],[32,28],[68,28],[22,46],[78,46],
    116. [50,44],[38,62],[62,62],[50,78]
    117. ];
    118. points.forEach(([x, y], i) => {
    119. const b = document.createElement('i');
    120. b.className = 'bulb';
    121. b.style.left = x + '%';
    122. b.style.top = y + '%';
    123. b.style.setProperty('--c', colors[i % colors.length]);
    124. b.style.setProperty('--d', (0.9 + Math.random() * 1.1).toFixed(2) + 's');
    125. b.style.setProperty('--delay', (-Math.random() * 3).toFixed(2) + 's');
    126. bulbs.appendChild(b);
    127. });
    128. requestAnimationFrame(() => {
    129. document.body.classList.add('ready');
    130. });
    131. </script>
    132. </body>
    133. </html>

    The implementation has three important optimization points:

    1. Snowflake movement uses only transform, avoiding layout recalculation.
    2. The animation scale is controlled: 50 snowflakes plus 9 lights.
    3. The prefers-reduced-motion media query provides a fallback for users who prefer limited motion, improving accessibility.

    5. Acceptance Criteria and Scoring

    A 100-point scoring system can be structured as follows:

    • Runnable implementation: 20 points
    • Requirement compliance: 25 points
    • Visual fidelity: 20 points
    • Performance: 15 points
    • Responsive behavior: 10 points
    • Code quality: 10 points

    Runnable implementation means the file can be opened directly and runs without console errors.

    Requirement compliance should verify the specified colors, element counts, animation cycles, and absence of external dependencies.

    Performance evaluation should focus on whether scrolling and animations remain smooth, whether frames are dropped, and whether top or left is used to drive animations.

    Responsive testing should verify that the heading and tree do not overflow on mobile screens.

    Code quality should consider DOM generation, the use of CSS custom properties, and general maintainability.

    6. Common Failure Modes

    Typical problems include:

    • Importing external fonts or animation libraries and violating the zero-dependency requirement
    • Using top or left to animate snowflakes, causing layout recalculation
    • Making all lights blink in sync, resulting in a mechanical appearance
    • Allowing the tree to extend beyond the mobile viewport
    • Creating too many animated elements and increasing main-thread pressure
    • Omitting a reduced-motion fallback

    The recommended improvements are to prioritize transform and opacity, minimize continuous layout calculations, use CSS custom properties and media queries appropriately, and keep the total number of animated elements under control.

    7. Conclusion

    The value of AI code generation evaluation is not a one-time ranking. It lies in establishing a reproducible engineering acceptance process.

    Clear requirements, executable results, and recorded metrics make it possible to determine whether a model truly understands a specification—or merely generates a page that looks approximately correct.