Build a subtle festive animation with an off switch
Request a lightweight visual effect that respects reduced-motion preferences.
Inputs & setup What you need before copying
Bring: PAGE MARKUP; SPARKLE OR LANTERN; PALETTE
Start here: Paste your existing markup. Review and test the returned code locally before adding it to a website.
What you need: Existing page markup, preferred effect, colour palette and supported browsers.
Before you start: Paste your existing markup. Review and test the returned code locally before adding it to a website.
Best for: Coding & development
Use this prompt with: A text assistant that supports your inputs.
Choose a tool that supports the files or features listed above.
Example result
Sample input
Plain HTML page; subtle gold sparkle effect; no external libraries; modern browsers. Example below uses three decorative dots rather than a full-screen overlay.
HTML <button id="motion" aria-pressed="false">Turn sparkle on</button> <div id="sparkles" aria-hidden="true"><i></i><i></i><i></i></div> CSS #sparkles { pointer-events:none; position:fixed; inset:0; overflow:hidden; z-index:-1; } #sparkles i { position:absolute; width:4px; height:4px; background:#b18a28; border-radius:50%; left:20%; top:35%; opacity:.4; } #sparkles i:nth-child(2) { left:60%; top:20%; } #sparkles i:nth-child(3) { left:80%; top:65%; } #sparkles.running i { animation:drift 8s ease-in-out infinite alternate; } @keyframes drift { to { transform:translateY(-18px); } } @media(prefers-reduced-motion:reduce) { #sparkles i { animation:none!important; } } JavaScript (place after the HTML) const button = document.querySelector('#motion'); const scene = document.querySelector('#sparkles'); const reduce = matchMedia('(prefers-reduced-motion: reduce)'); let enabled = false; function render() { const active = enabled && !reduce.matches; scene.classList.toggle('running', active && !document.hidden); button.disabled = reduce.matches; button.setAttribute('aria-pressed', String(active)); button.textContent = reduce.matches ? 'Reduced motion is on' : active ? 'Turn sparkle off' : 'Turn sparkle on'; } button.addEventListener('click', () => { enabled = !enabled; render(); }); reduce.addEventListener('change', render); document.addEventListener('visibilitychange', render); render(); Checks: Tab to the button and activate it; toggle reduced motion in system settings; switch tabs; verify links remain clickable. The example is illustrative code, not a recorded cross-browser test.
Make it yours Fill in your details
Optional. Your details stay in this browser tab.
Read full prompt
Using [PAGE MARKUP], create a small decorative [SPARKLE OR LANTERN] effect with HTML, CSS and vanilla JavaScript. Palette: [PALETTE]. Return complete runnable code and explain where it goes. Use at most 12 decorative elements, no flashing, no pointer interception and no changes to page layout. Mark decorations aria-hidden. Provide a keyboard-operable toggle with a clear on/off state. Respect prefers-reduced-motion on first load and when it changes; reduced-motion must stop the effect regardless of the toggle. Pause work when the page is hidden. Do not add libraries, analytics or network calls. Include a small manual test checklist; do not claim the code has been tested unless it was actually run.
Check your result
- Test in the actual page. Adjust the decorative layer so it stays behind content without becoming hidden behind an opaque background.
Where do I use this prompt?
Copy it into ChatGPT, Claude, Microsoft Copilot.