Vibe Coding an Animated App Onboarding Flow with Cursor and Rive MCP
By the Charmotion team · Updated · How we write guides

You vibe code an animated onboarding flow by connecting Cursor to an MCP server that returns a Rive (.riv) file, asking the agent to create a character with the moods each screen needs, then wiring one mood number per screen into your React app. Then check each state in the browser before shipping.
Key takeaways
- Connect the MCP server in .cursor/mcp.json, then sign in with OAuth so no API key goes in the file.
- Map each onboarding screen to one mood number before you prompt, so the agent builds the right animations.
- Wire one component that writes the mood input; the .riv file does the animating.
- Test every state in the browser and keep the mood map in a Cursor rules file.
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 do you need before you start?
This walkthrough shows how to vibe code an animated onboarding flow with Cursor and a Rive MCP, from an empty React or Next.js project to a splash screen, a welcome step and a loading state that play real Rive animation. The wiring code uses React, but the same mood plan works with any Rive runtime.
You need four things:
- Cursor with MCP support. Cursor reads server definitions from a JSON file, covered in the next section.
- One character image. A finished, coloured character facing the viewer, with visible eyes and mouth. Sketches, photos, groups and busy scenes are refused, and a refused image is not charged. No image yet? The AI designer can draw one for 1 credit.
- A sign-in for the MCP server. AI designs get 2 free credits on the Free plan, and character animations need a paid plan. Current plans are on the pricing page.
- A React project. A Vite or Next.js app managed with npm is enough.
You do not need a Rive editor login for these steps. If you later hand-edit states in the Rive editor, its free plan exports .riv files with a Rive splash screen, so read Is Rive free? before a product release.
How do you connect the MCP server to Cursor?
The server in this guide is the Charmotion remote MCP server at https://charmotion.app/mcp. It turns one character into a Rive (.riv) file, which is the Rive part of the workflow. It uses Streamable HTTP with OAuth sign-in, so there is no API key to paste. Details are on the MCP server page.
Cursor reads MCP servers from mcp.json. A project file at .cursor/mcp.json keeps the setup with the repo, and ~/.cursor/mcp.json applies to every project. Server entries sit under a top-level mcpServers object, and a remote server takes a url:
{
"mcpServers": {
"charmotion": {
"url": "https://charmotion.app/mcp"
}
}
}Cursor's documentation at cursor.com/docs/mcp describes remote servers and variable substitution such as ${env:NAME} in url and headers. Save the file, open Cursor's MCP settings and finish the sign-in for the charmotion server in your browser. Cloud agents do not read ~/.cursor/mcp.json, so configure them on cursor.com/agents if you plan to use them.
If you want the same setup for a logo rather than a character, the guide to animating a logo from Claude, Cursor or VS Code covers it.
How do you map onboarding screens to character moods?
Plan the states before you prompt. Each character exposes one number input called mood, and every mood has a fixed number: idle 0, happy 1, wave 2, thinking 3, sad 4, loading 5, listening 6, talking 7, sleeping 8, attention 9. Idle runs on its own and costs no credits. Moods blend into each other, so a change from one screen to the next reads as motion, not a cut.
The mascot state planner can draft a table like this one. The onboarding and empty state guide covers the copy for each screen.
| Screen | Mood | Number | Animation to pick |
|---|---|---|---|
| Splash | launch, then idle | 0 | launch (2.6 s, plays once, ends on idle) |
| Welcome | wave | 2 | wave (3.0 s) |
| Goal question | listening | 6 | listening (3.0 s) |
| Feature tour | happy | 1 | happy (1.6 s) |
| Setup in progress | loading | 5 | loading (1.2 s) |
| Permission needed | attention | 9 | attention (1.4 s) |
| Success | happy | 1 | happy, used as the success signal |
| Error | sad | 4 | sad, used as the error signal |
Characters have no one-shot triggers, so a success is shown with happy and an error with sad. Launch, happy, wave and loading are preselected. Listening, attention and sad add one credit each, so ask for all of them in one request and the set is built once.
How do you generate the character set from the chat?
Ask the agent to build the whole set in one request, so you get one .riv file with every mood the flow uses. The server's tools do the work: design_character draws a character if you have no image, create_character_set builds the animations you chose, and get_character_set returns download links and the AI_README for coding assistants.
Using the charmotion server, create a character set from assets/mascot.png with launch, wave, happy, loading, listening, attention and sad. Then call get_character_set, save the .riv file to public/mascot/ and save the AI_README to docs/.
The image is checked first, and a sketch or photo is refused without a charge. If the drawing is 3D, furry, plush or very detailed, the server can redraw it in the house style for 1 credit, and you choose which version to animate. Animations the engine cannot make give their credit back automatically, and a review step checks each animation before delivery.
If a mood looks wrong, ask for a redo in the chat rather than editing the file by hand. Video copies for a landing page come from export_videos, which takes about a minute and uses no credits.
How do you wire the .riv file into each onboarding step?
Ask Cursor for one component that takes a step name and writes the mood input. Install the React canvas runtime with npm install @rive-app/react-canvas. The component below loads CharacterStateMachine and sets mood whenever the step changes.
import { useEffect } from 'react';
import { useRive, useStateMachineInput } from '@rive-app/react-canvas';
const MOOD = { idle: 0, happy: 1, wave: 2, thinking: 3, sad: 4, loading: 5, listening: 6, attention: 9 };
export function OnboardingMascot({ step }) {
const { rive, RiveComponent } = useRive({
src: '/mascot/character.riv',
stateMachines: 'CharacterStateMachine',
autoplay: true,
});
const mood = useStateMachineInput(rive, 'CharacterStateMachine', 'mood');
useEffect(() => {
if (mood) mood.value = MOOD[step] ?? MOOD.idle;
}, [mood, step]);
return <RiveComponent className="mascot" />;
}Size the canvas in your stylesheet, using the mascot class, so it fits the layout of each screen. Rive's React docs mark the useStateMachineInput hook as deprecated in favour of data binding hooks. If the AI_README in your download shows a different call, use that one. For server rendering and setup details, read how to use Rive in React and Next.js.
The launch state machine exists only when launch was picked. It plays once and ends on idle, so load LaunchStateMachine on the splash screen, then switch to the component above for the welcome step and the screens after it. For driving moods from app state in more detail, see how to drive Rive mood states from app state.
How do you test each onboarding state before release?
Build a dev route with one button per step, then click through the flow in Chrome, Firefox and Safari. Check four things: the mood input exists with that exact name, each number matches the table, launch plays once, and the character returns to idle between steps.
- Open the file in the Rive file inspector to confirm the state machines, input names and the mood property.
- Use the animated previews to see each mood before you download anything.
- If you also ship a video fallback, serve transparent WebM for Chromium and Firefox, which display alpha. Safari has been reported to ignore WebM alpha, so serve a transparent HEVC .mov there. Apple documents HEVC with alpha for Safari.
Give users a static idle when reduced motion is on, since a looping character can distract people who turn motion off. Check the state on a phone-sized viewport too, because the canvas scales with its container.
How do you keep the agent from breaking the flow later?
Put the mood table and the component rules in the repo, so every new prompt starts from the same facts. Cursor's older .cursorrules file is being phased out in favour of .cursor/rules/*.mdc project rules and AGENTS.md, so write the rules as an .mdc file. Cursor also reads CLAUDE.md as a project instruction file.
Rules worth adding:
- Mood numbers come from the table only. The agent should not invent new numbers.
- Change animations by asking the server again. Use add_animations for new moods; only the new ones use credits.
- Keep the .riv file and the AI_README under version control, and review the component diff after every regeneration.
For a full rules pattern, read writing CLAUDE.md and .cursorrules for Rive data binding. The MCP server page lists the tools used in this guide, and previews need no account.
Vibe code an animated onboarding flow with Cursor and a Rive MCP
- Add the MCP server. Create .cursor/mcp.json with a charmotion entry whose url is https://charmotion.app/mcp, then finish the OAuth sign-in from Cursor's MCP settings.
- Plan the moods. Map each onboarding screen to one mood number from the fixed list, such as wave 2 for the welcome screen and loading 5 for setup.
- Generate the character set. Ask the agent to create a character set with the animations you chose, then fetch the download links and save the .riv file and AI_README.
- Add the component. Ask Cursor for a component that takes a step name and writes the mood input of CharacterStateMachine each time the step changes.
- Wire the screens. Render the component on the splash, welcome, loading, success and error screens, and load LaunchStateMachine on the splash screen so launch plays once.
- Test and lock the rules. Click through every state in Chrome, Firefox and Safari, then store the mood map in a Cursor rules file so later prompts keep the numbers fixed.
Frequently asked questions
Does this need a Rive editor account?
No Rive login is needed for the steps here. The server returns the .riv file, and the React runtime plays it in the browser. The Rive editor is a separate tool for custom changes. Read Rive's pricing before exporting files for a product, because the free plan's exports show a splash screen.
Can the coding agent edit the .riv file directly?
Not reliably. The practical route is to have the agent call the server again, with create_character_set or add_animations, then download the new file. Keep the source image, the mood map and the component in the repo so you can rebuild the set at any time.
Which browsers need a video fallback?
Chromium and Firefox display WebM with alpha, while Safari has been reported to ignore it. Safari plays HEVC with alpha in a .mov file. The Rive file itself needs no video fallback where the runtime loads, so use video only where a plain video element is simpler.
Do retries and refused images cost credits?
A refused image is not charged, and neither is a refused prompt. An animation the engine cannot make gives its credit back automatically. Exports do not use credits, so you can re-export video copies while you tune the states.
Sources
- Cursor MCP documentation, Cursor
- Cursor project MCP configuration, Cursor
- Rive pricing, Rive
- Rive editor, Rive
- Using HEVC video with alpha, Apple Developer
- Alpha transparency in Chrome video, Chrome for Developers
Related guides
- How to Animate a Logo or Character From Claude, Cursor or VS Code With MCP
- How to Add a Mascot to Onboarding and Empty States
- How to Use Rive in React and Next.js
- How to Drive Rive Character Mood States (idle, happy, wave, loading) from App State
- Writing CLAUDE.md and .cursorrules for Rive Data Binding Mascot Integrations