How to Use an Animated Mascot in Cookie Consent & Privacy Prompts
By the Charmotion team · Updated · How we write guides

An animated mascot in a cookie consent banner should stay decorative: it waves once when the banner appears, shows neutral states while a choice saves, and never celebrates accept over reject. Build it as a .riv file driven by a mood number, load it after the buttons render, and respect reduced motion. Your consent tool still decides what loads.
Key takeaways
- A mascot in a cookie consent banner is decoration, so it must never make accept look more rewarding than reject.
- Map each banner moment to one mood number: wave once on show, idle while waiting, loading while saving.
- Ship the mascot as a .riv file driven by a number input, and load it after the banner's buttons are on screen.
- Honor prefers-reduced-motion and mark the canvas aria-hidden so the mascot never competes with the choices.
- Test the banner at phone widths before release, because a mascot that covers a button undermines the choice more than any animation adds.
Already have a character or logo? See examples in real app screens: splash, onboarding, loading and empty-state screens, with the animation that plays in each.
Should a cookie consent banner have a mascot at all?
Yes, if the mascot stays out of the choice. This guide covers how to add an animated mascot to a cookie consent banner without weakening the choice. A banner exists to ask a visitor a clear question and record the answer. Animation can add a friendly tone, but it can also pull attention toward one button. Treat the mascot as a presentation detail, the same way you treat the logo or the font.
Three rules keep it honest:
- Equal weight. Accept and reject get the same size, contrast and placement. The mascot does not point at, glow near or reward either one.
- No celebration on a choice. A happy state or sparkles after “Accept all” reads as approval of that option. Use the same neutral state after every button.
- No delay or pressure. The buttons render first, without waiting for the mascot to finish a wave, and nothing animated sits on top of them.
The consent wording, the categories and what loads before a choice are decisions for your legal review and your consent tool. This guide covers only the animation layer.
Which mascot state fits each consent moment?
Each moment needs its own state, and the states should be quiet. The mood numbers below are fixed: idle 0, happy 1, wave 2, thinking 3, sad 4, loading 5, listening 6, talking 7, sleeping 8 and attention 9. Any Rive character with a numeric mood input can use the same map.
| Banner moment | Mood | Why |
|---|---|---|
| Banner first appears | 2 wave, then 0 idle | One greeting of about 3.0 seconds, then stillness |
| Waiting for a choice | 0 idle | Breathing and blinking loop with no pull toward a button |
| Choice being saved | 5 loading | A short 1.2 second loop that signals work in progress |
| Choice saved | 0 idle | Neutral after accept, reject or custom choices |
| Save failed | 4 sad | Pair with plain text that says what to do next |
| Settings panel open | 6 listening | Optional; shows the panel is waiting for input |
Keep the mascot out of talking during the banner. A consent banner does not need lip movement, and talking suggests the mascot is reading the legal text aloud.
How do you build the mascot file for a banner?
A banner is a small space, so one .riv file is the right container. It holds the artboard, the animations and the state machine, and it loads straight into a web page with no video player or playback controls. Rive's runtimes are open source and play any .riv file, so the file is not tied to one banner tool.
You have two routes:
- Design it in the Rive editor. Build a state machine with a number input named mood, map each state to a value from the table, and keep every loop short. The Rive Editor covers state machines and data binding. The setup is explained in Rive state machine inputs.
- Generate it from one image. Charmotion turns one finished, front-facing character into one Rive file with a CharacterStateMachine and a mood number input, plus web code and transparent video copies. Its animations include wave (3.0 seconds), loading (1.2 seconds), attention (1.4 seconds) and sad (3.0 seconds), and idle is always included. Set the boolean accents to false if the banner should show no sparkles or exclamation marks. Credits and plans are on the Charmotion pricing page.
Either way, export for a live site on a paid Rive plan. Files exported on the free plan play a Rive splash screen, which a consent layer should not show. The details are in Is Rive free?
How do you wire the mascot to the banner in code?
The banner is ordinary HTML. The mascot is a canvas inside it, and a small script sets the mood number. The example uses the Rive web runtime from the @rive-app/canvas package, which loads its WASM module from the default CDN unless you host it yourself. Self-hosting is covered in Rive's WASM preloading docs.
Start with the markup. The canvas is marked decorative so screen readers skip it:
<div class='consent-banner' role='dialog' aria-labelledby='consent-title'>
<canvas id='consent-mascot' width='160' height='160' aria-hidden='true'></canvas>
<h2 id='consent-title'>Cookies on this site</h2>
<p>We use analytics cookies only if you allow them.</p>
<button>Accept</button> <button>Reject</button> <button>Settings</button>
</div>Then the script. It skips every mood change when reduced motion is requested:
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const mascot = new rive.Rive({
src: '/assets/mascot.riv',
canvas: document.getElementById('consent-mascot'),
stateMachines: 'CharacterStateMachine',
autoplay: true
});
function setMood(value) {
if (reduceMotion) return;
const inputs = mascot.stateMachineInputs('CharacterStateMachine');
const mood = inputs.find(function (input) { return input.name === 'mood'; });
if (mood) mood.value = value;
}
setMood(2);
setTimeout(function () { setMood(0); }, 3000);Call setMood(5) when a choice starts saving, setMood(0) when the save finishes, and setMood(4) if it fails. Only call these after the banner's buttons are in the DOM. Keep the mood numbers in one constants object so the mapping lives in a single place.
How do you keep the mascot accessible and light?
A consent banner has to work for everyone who meets it, including people who turn off motion at the system level. Three checks cover most of the risk:
- Reduced motion. When prefers-reduced-motion is set, the script above keeps the mascot on its first frame. Check that your CSS also drops any slide-in or fade on the banner itself. The broader pattern is in accessible animation and reduced motion.
- Hidden from assistive technology. aria-hidden on the canvas keeps the decorative figure out of the accessibility tree. Focus should land on the dialog title or the first button, never on the mascot.
- Small and fast. Keep the canvas around 120 to 160 pixels, and load the .riv after the banner text and buttons. The choice works even if the animation file is slow or fails.
On narrow screens, hide the mascot below a width you test rather than shrinking it over text. It must never cover the Accept, Reject, Settings or cookie policy links.
How to add an animated mascot to a cookie consent banner
- Decide the mascot's role. Write down that the mascot is decorative. Give accept and reject the same size, contrast and placement, and never reward one option with a happy state.
- Map banner moments to moods. Use wave (2) once when the banner appears, idle (0) while waiting, loading (5) while a choice saves, and sad (4) if saving fails.
- Build or generate one .riv file. Create a file with a number input named mood, either in the Rive editor or from one character image. Export it for a live site on a paid Rive plan.
- Write the markup. Render the banner text and buttons first, and mark the canvas aria-hidden so assistive technology skips it.
- Wire setMood with a reduced-motion check. Load the .riv with the Rive web runtime, skip mood changes when prefers-reduced-motion is set, and return to idle after the wave ends.
- Test before release. Check slow connections, phone widths, reduced motion, each button and the mood input name in the Rive file inspector before publishing.
Frequently asked questions
Does a mascot change whether a cookie consent is valid?
The mascot is not a consent mechanism and does not record a choice. Whether a banner gives valid consent depends on its wording, the options it offers and what loads before a choice, which is a matter for your legal and privacy review. Keep the mascot neutral so it adds no pressure in either direction.
Can I use a transparent video instead of a Rive file?
You can, but video needs more than one format. Chromium-based browsers and Firefox display transparent WebM, while Safari has been reported to ignore VP9 alpha, so a HEVC alpha .mov fallback is usually needed. A .riv file avoids that split, and Rive's runtimes are open source and play any .riv file.
Does Rive provide a cookie banner template?
Rive does not document a cookie banner template as of December 2026. The banner is ordinary HTML and CSS, and the .riv file only supplies the animated figure inside a canvas.
Sources
- Rive Editor, Rive
- Rive pricing, Rive
- Rive web runtime parameters, Rive
- Preloading the Rive WASM runtime, Rive
- What is a .riv file and how is it used, ICS Media
- Charmotion pricing, Charmotion