Build a CSS Cubic-Bezier Easing Curve Visualizer with Draggable Handles

A single HTML file with a draggable bezier curve editor that races test boxes against CSS built-in easings and gives you a ready-to-paste cubic-bezier value.

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 who builds polished motion design tools.

Build Curvewright, a cubic-bezier easing lab. On the left is a square curve editor drawn in inline SVG with two draggable control-point handles, one coral and one teal. On the right is a side-by-side race where boxes slide across tracks: one lane uses the user's custom curve, and the others use linear, ease, ease-in, ease-out and ease-in-out. Every lane runs for the same duration.

Rules:
1. Handle x values stay between 0 and 1. Handle y values can go from -0.5 to 1.6, so users can create overshoot and anticipation. Make dragging work with mouse and touch through pointer events. A focused handle moves with the arrow keys, with Shift for bigger steps.
2. While the user drags, update the custom lane's easing live. Show the exact value, rounded to 2 decimals, in a code readout with a Copy button. If clipboard access fails, select the text instead.
3. Animate the boxes with the Web Animations API using the real CSS easing strings. Draw a dot that travels along the curve in sync with the boxes.
4. Add a Play button, Space to replay, a duration slider from 300 to 3000 ms, a Loop checkbox, and preset chips (snappy, overshoot, anticipate and the CSS keywords).
5. Use a dark palette with coral, teal and warm yellow accents. The layout is two columns that stack below 820px. With prefers-reduced-motion, turn off autoplay and looping.

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: Curvewright, a cubic-bezier easing lab with a live race track.

Drag the coral and teal handles to bend the curve. The Your curve box updates mid-race while a yellow dot rides along the curve. Tap preset chips like overshoot or anticipate to load them, adjust the duration slider, and press Space to race again. Click Copy to grab the exact cubic-bezier value. You can also Tab to a handle and nudge it with the arrow keys.

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

Tips and common edits

Why this works

  • Using the Web Animations API with real easing strings means the boxes move exactly as your CSS will, so there is no approximation.
  • Clamping handle x to 0–1 keeps every curve a valid cubic-bezier, and wide y limits still allow overshoot.
  • Pointer events plus keyboard nudging make the handles work for mouse, touch and keyboard users without extra libraries.

Paste into ChatGPT, Claude or Gemini. Save the returned code as curvewright.html and open it in any modern browser, or run it in the chat's preview or canvas panel.

Common edits

  • Swap the comparison lanes for your design system's motion tokens so you can test new curves against the existing ones.
  • Add a second animated property, such as scale or opacity, to each box to judge how the easing feels on fades and pops.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Animations & Effects