Skip to content
Limited timeStarter is now $9 a month instead of $20.See plans
charmotion

How to Build a Duolingo-Style Streak Celebration Mascot Animation

By the Charmotion team · Updated · How we write guides

Cover illustration for the guide: How to Build a Duolingo-Style Streak Celebration Mascot Animation, with Charmotion demo characters

To build a streak celebration mascot animation in an app, make a short happy state in Rive and drive it from your streak data. Map each streak event to one mood number, and let the mascot return to idle after the reward. Keep the reward under two seconds and skip it when reduced motion is on.

Key takeaways

  • A streak celebration is one short happy state, not a long video, and it should end on idle.
  • Rive state machine inputs (number, boolean and trigger) let app code drive the mascot at runtime.
  • A character file with a number input named mood lets you map each streak event to a fixed mood number.
  • Under reduced motion, show a static streak badge instead of the mascot clip.

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.

What should a streak celebration mascot show?

This guide shows how to build a streak celebration mascot animation in an app, from the moments that need a reward to the code that plays it. The reward has one job: confirm the streak grew, then get out of the way. The mascot cheers, the count updates and the user goes back to the task. If the animation blocks the next tap for more than a couple of seconds, it has stopped being a reward.

Plan the moments before you animate anything. A streak feature usually needs five: the daily extension, a milestone such as seven or thirty days, a streak at risk, a streak that broke, and the idle state the mascot holds the rest of the time. Write each one down with the data that triggers it, so the animation follows real events instead of screen visits.

For the wider state set, read Duolingo-style mascot animation: states, reactions and effort. This guide stays on the streak feature itself: the mapping, the Rive setup, the code and the timing.

How do you map streak events to mascot states?

Use one mood per moment, not one clip per screen. In a Rive file with a number input called mood, each moment becomes a number. The mood numbers below are fixed, so the same mapping works for any character built on them:

Streak momentMoodNumberClip length
Streak extended todayhappy11.6 s
Milestone reachedwave23.0 s
Streak at risk, reminder shownattention91.4 s
Streak brokesad43.0 s
Saving the streak to the serverloading51.2 s
Everything elseidle04.0 s loop

Characters in this format have no one-shot triggers, so there is no success or error trigger. Show a success with happy and an error with sad, and let your app decide when to switch back. Small accents such as sparkles on happy are on by default, and a boolean named accents hides them.

Celebrate the act of showing up, not the number alone. A three-day streak deserves a small reward, and the mascot should never scold the user for a broken one. Use wave for milestones and keep happy for the daily extension, so the user learns the difference between a normal day and a big one without reading any text.

How do you set up the Rive file for the reward?

The mascot's states live in the Rive file, so the app only sends numbers. Build the state machine in the Rive editor, which covers state machines, data binding and scripting. A .riv file bundles the artboards, animations, state machines and data binding settings, and a runtime loads it directly into the app.

  1. Open the character artboard and create a state machine. Give it a number input named mood.
  2. Connect each mood state to its value, with idle at 0. Use the same numbers as the table so the app code matches the design file.
  3. Add a boolean input only if you need a yes or no switch, such as accents on or off.
  4. Export the .riv. On Rive's free plan, exported files play a Rive splash screen, so ship from a paid plan. See Is Rive free? Pricing, plans and commercial use in 2026.

Rive's own documentation describes state machine inputs as boolean and number values that drive transitions, plus triggers that fire one-shot events. For a streak reward, the number input is the right tool because the mascot must return to a fixed state afterward.

If you would rather not rig the character yourself, Charmotion (how it works) takes one finished character image with a front-facing face and visible eyes and mouth, and returns one .riv. Its CharacterStateMachine has the mood number input, and the file also includes a CharacterViewModelMachine with a number property named mood, so you can bind either one. Plans and credits are on the pricing page.

How do you drive the mascot from streak data in app code?

Rive exposes state machine inputs at runtime, so the app can change the mood without reloading the file. In the web runtime, get the list of inputs with stateMachineInputs and the state machine name, find the input by name, then set it. Number and boolean inputs expose a value property. Trigger inputs are fired by calling a method on them. The Flutter runtime creates a controller from the artboard and state machine name, then reads controller.stateMachine.inputs. Android sets number, boolean and trigger values through separate methods on the view.

const MOODS = { idle: 0, happy: 1, sad: 4, attention: 9 };

function setMood(rive, mood) {
  const inputs = rive.stateMachineInputs('CharacterStateMachine');
  const moodInput = inputs.find((input) => input.name === 'mood');
  if (moodInput) moodInput.value = mood;
}

function celebrateStreak(rive) {
  if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
  setMood(rive, MOODS.happy);
  // The happy clip is 1.6 s; return to idle when it ends.
  setTimeout(() => setMood(rive, MOODS.idle), 1600);
}

The React runtime has a useStateMachineInput hook that takes the Rive instance, the state machine name and the input name. Its help page marks that hook as deprecated in favor of data binding hooks, so check the current React docs before you copy it. For wiring by framework, see How to add animation to a React or Next.js app.

Call celebrateStreak from the server's confirmation, not from the screen's load code. A user who opens the home screen twice should not see the reward twice. Save the last celebrated day on the device and compare it before you play.

Plan for failure too. If the .riv does not load, keep the streak count on screen as text and skip the mascot. The number still reaches the user, and the reward is an extra, not the only signal.

How long should the celebration last and what should it do?

Keep the reward under two seconds of motion. The happy clip in this setup runs 1.6 s, so a 1600 ms timer returns the mascot to idle as the clip ends. Launch intros run 2.6 s, which is too long for a reward that sits between the user and their next tap. Update the streak count as text at the same moment, so the information arrives even while the mascot is still moving.

  1. The app receives the confirmed streak update and writes the new count to the screen.
  2. The mascot switches to happy (1).
  3. After 1600 ms, the mascot switches back to idle (0).
  4. The celebration does not repeat until the next streak event.

Reduced motion needs its own path. When the system asks for less motion, skip the mascot change and show a static badge with the count. The mascot can still appear in its idle pose. The wider rules are in Accessible animation: reduced motion and WCAG, and animation durations and loading UX covers the timing of waits and transitions.

How do you test every streak state before release?

Test each moment, not only the happy path. Open the file in the mascot state planner to list the states and their numbers, then check the .riv in the online .riv preview before it reaches a build.

  • Set each mood number from 0 to 9 and confirm the state holds until the next change.
  • Fire two streak events in a row and confirm the second one plays.
  • Close the app during the celebration and confirm it opens on idle.
  • Fire the streak event offline and confirm it is queued once, not lost or replayed twice.
  • Turn on reduced motion in the device settings and confirm the badge replaces the clip.

For how these states fit into a larger set, read Mascot animation states: loading, success, error and Rive state machine: inputs, triggers and moods.

How to build a streak celebration mascot animation in an app

  1. Define the streak moments. List the moments that need a reward: streak extended, milestone, at risk, broken and saving. Write the data that triggers each one.
  2. Map each moment to a mood number. Use the fixed mood numbers from the table: happy 1, wave 2, attention 9, sad 4, loading 5 and idle 0.
  3. Build the state machine in Rive. Create a state machine with a number input named mood, then export the .riv from a paid plan so it has no splash screen.
  4. Drive the input from streak data. When the server confirms the streak changed, find the mood input by name in the runtime and set its value to 1.
  5. Return to idle after the reward. Set mood back to 0 after 1600 ms so the celebration plays once per streak event.
  6. Test every state and reduced motion. Set each mood, fire events twice, test offline use, and confirm that reduced motion shows a static badge instead of the clip.

Frequently asked questions

Can I build a streak celebration without a Rive file?

Yes, with a short video or a Lottie file, but you lose the state machine. A video plays the same clip each time and cannot switch back to idle on its own, so your app needs a second asset or a timer and a hard cut. A Rive file keeps idle, happy, sad and attention in one asset, which is why streak screens often use it.

Does the celebration need a paid Rive plan?

You can build on the free plan, but exported .riv files play a Rive splash screen there. Paid plans export without it, which is what you want for a shipped app. Check rive.app/pricing for current plan details, since prices and limits change.

How often should a streak celebration play?

Once per real streak event, on the screen where the user earned it. Replaying it on every app open teaches users to skip it. Store the last celebrated day on the device so a relaunch does not replay the reward.

Should the mascot celebrate a broken streak?

No. Use a gentle sad state or an attention state with a clear next step, not a celebration and not a scolding. Offer a repair action where your product allows one, and keep the wording short and kind.

Sources

Related guides