Generate a CSS @keyframes rule and animation declaration from a name, duration, timing function and keyframe list, with reduced-motion handling.
Generate CSS for the animation described below. Output a valid `@keyframes` rule plus an `animation` declaration on the target selector. Duration, timing function and other playback options belong to the `animation` declaration, not inside `@keyframes`. ## Inputs Animation name (a valid CSS identifier): [ANIMATION_NAME] Target selector: [SELECTOR] Duration (s or ms): [DURATION] Timing function (linear, ease, ease-in-out, cubic-bezier(...), steps(...)): [TIMING_FUNCTION] Keyframes as offsets (0-100%) with their styles: [KEYFRAMES] Optional: iteration count, direction, fill mode, delay, play state: [OPTIONS] Reduced-motion behaviour wanted (remove, shorten, or replace with a fade): [REDUCED_MOTION] ## Instructions 1. Write `@keyframes [ANIMATION_NAME]` with offsets in ascending order. Merge offsets that share identical styles only if the result stays readable. 2. Prefer animating `transform` and `opacity`. If the requested properties trigger layout (for example width, top, margin), keep them but note the cost and suggest a transform-based alternative. 3. Write the `animation` shorthand on [SELECTOR], or longhand properties if the shorthand would be ambiguous. Include only the options provided. 4. Add a `@media (prefers-reduced-motion: reduce)` block implementing [REDUCED_MOTION]. 5. If an input is invalid (offset outside 0-100%, unknown timing keyword, name that is not an identifier), explain the problem instead of guessing. ## Return 1. The CSS in one code block. 2. A short list mapping each input to where it appears in the CSS. 3. Notes on performance or accessibility tradeoffs, if any. ## Acceptance checks - Keyframe offsets are between 0% and 100% and in ascending order. - The animation name in the declaration matches the `@keyframes` name exactly. - Options not supplied are not added. - A reduced-motion block is present.
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
Content reviewed .
Name: toast-in
Selector: .toast
Duration: 320ms
Timing: cubic-bezier(0.2, 0.8, 0.2, 1)
Keyframes: 0% {opacity: 0; transform: translateY(12px)}, 100% {opacity: 1; transform: translateY(0)}
Options: fill-mode both
Reduced motion: replace with an opacity-only fadeCSS containing @keyframes toast-in with 0% and 100% blocks as given; .toast { animation: toast-in 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }; and a prefers-reduced-motion: reduce block that switches .toast to an opacity-only keyframes animation without translateY. No iteration count or direction is added. A static checker run locally on a hand-written reference of this shape confirmed ascending offsets, matching names and a reduced-motion block (see report); model output itself was not run.Ask questions or share concrete improvements.
No comments yet.
Sign in to join the discussion.
Guides for adapting and checking prompts: