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
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
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 like this
Build a Responsive Pricing Comparison Infographic with Monthly/Yearly Toggle
A prompt that produces one self-contained HTML pricing page with three plans, a highlighted recommended tier, a monthly/yearly toggle that recalculates savings, swipeable cards on phones and a full comparison table.
Build a 100-Person Icon Array Demographic Infographic in One HTML File
You get a single HTML file that shows a fictional town as 100 SVG person icons, with tabs for commute, age and housing and an interactive legend that highlights each group.
Build a 12-Week Fitness Progress Tracker Infographic in a Single HTML File
Generates a one-page fitness report with bodyweight and lift line charts, personal-record badges, a streak calendar and an instant kg/lb toggle, all from built-in sample data.
Build a Before-and-After Statistics Infographic With Color-Coded Change Arrows
A single HTML infographic comparing two years across nine metrics, showing old and new values, absolute and percent change, and arrows colored by whether up is good.
Build a Budget Allocation Treemap Infographic in a Single HTML File
You get one HTML file that draws a squarified treemap of a city budget, hides labels on small blocks, and shows a details panel when you tap or click any block.
Build a Classroom Grade Distribution Infographic with Histogram and Quartiles
A single HTML file that turns an inline array of class scores into a histogram with mean and median markers, a box plot, stat cards and a plain-language summary.