Build an Animated Two-Option Comparison Infographic With Weighted Scores

A ready-to-paste prompt that produces a single HTML file comparing two options with animated split bars, adjustable weights, weighted totals and a winner badge.

You getone complete HTML file in a single code block, then 3 short ideas to extend it.

The prompt

Prompt
Act as a senior front-end developer and information designer. Build a single-page comparison infographic called "Split Decision: Heat Pump vs. Gas Boiler" that scores two home-heating options across seven criteria: upfront cost, running cost, carbon emissions, installation disruption, lifespan, quiet operation and hot water on demand. Each criterion has a one-line note, a 0-10 score per option and a weight from 0 to 3.

Rules:
1. Put every title, option name, color, criterion, score and weight in one DATA object at the very top of the script, so editing it rebuilds the whole page.
2. Each criterion row shows a split bar. Option A's bar grows left from a centre axis and option B's grows right, with scores at both ends and the leading score emphasised. Bars animate in with a short stagger, and the animation is skipped under prefers-reduced-motion.
3. Each row has accessible minus and plus buttons to change its weight. A weight of 0 greys the row out.
4. Two scoreboard cards show each weighted total out of 100 with a count-up, plus a "Winner" badge and a live verdict line such as "wins by 4.6 points". Handle ties and the case where every weight is zero.
5. Use a warm off-white background, deep navy text, teal for option A and burnt orange for option B. Use system fonts and tabular numbers, and stack the rows on screens narrower than 640px.
6. Add Replay and Reset weights buttons, and let the R key replay the animation. Use no external resources, storage or dialogs.

Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.

Example output

One HTML file. Save it and open it in any browser.Open full screen

Example: Split Decision, a heat pump vs. gas boiler scorecard.

Seven criteria appear as split bars: teal grows left for the heat pump and orange grows right for the boiler. Weighted totals count up to a score out of 100, and a Winner badge sits on the leading card. Use the − and + buttons to reweight each row. Try setting Upfront cost to ×3 and Carbon to ×0 to flip the verdict. Press R or Replay to rerun the animation.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • A single DATA object drives every label, score and weight, so the model builds the page from data and you can reuse it for any two options.
  • Fixed weight limits (0 to 3) and explicit tie and all-zero rules stop the verdict from breaking at edge cases.
  • Named colors, a stacking breakpoint and reduced-motion handling give a polished, accessible layout on the first try.

Paste into ChatGPT, Claude or Gemini. Save the code as comparison.html and open it in any browser, or view it in the chat's preview or canvas. To compare something else, edit the DATA object.

Common edits

  • Swap the DATA object for another matchup, such as two laptops, job offers or cities, and change the two option colors.
  • Change the weight range to 0 to 5, or add a short tone when the winner changes, using the Web Audio API with a mute toggle.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Infographics