Migrating Vibe-Coded Apps from CSS and Lottie Placeholders to Rive Data Binding via MCP
By the Charmotion team · Updated · How we write guides

Replace each CSS or Lottie placeholder with one state in a single .riv file, expose that state as a number in a Rive Data Binding ViewModel, and have app code write that number. Connect an MCP server so your coding agent can generate the file and its integration notes, then migrate one state at a time and check each one.
Key takeaways
- Map every CSS or Lottie placeholder to one named state before you change any code.
- Use one number property in a Rive Data Binding ViewModel as the single source of mood.
- Let an MCP-connected agent generate the .riv file and its integration notes, then review them.
- Migrate one state at a time and keep the old placeholder until the new one passes checks.
- Keep a rule in CLAUDE.md so future prompts do not bring the placeholders back.
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.
Why do vibe-coded apps end up with CSS and Lottie placeholders?
An AI coding agent asked for a friendly onboarding screen often builds the mascot from what it can write fast: a CSS pulse for loading, an emoji for success, or a Lottie file it downloaded from a free library. The screen works and ships. The cost comes later, when each state needs its own class or file and nothing ties the animation to what the app is doing.
This guide shows how to migrate a vibe-coded app from CSS or Lottie placeholders to Rive Data Binding via MCP. The pattern is simple: one .riv file holds the character, a ViewModel exposes its state as typed properties, and app code writes those properties instead of swapping classes or files.
Lottie is a reasonable starting point, not a dead end. A .lottie file is a ZIP archive that can hold animations, themes and state machines, and LottieFiles lists dotlottie-web 0.30.0 or later as the minimum for dynamic theming and state machine features. If your placeholder already has a state machine, the same mapping applies. For the design trade-offs, read Lottie vs Rive state machines and data binding.
What does each placeholder become in Rive?
Write the map before you change code. Each placeholder gets one state name and one target. This guide uses a ten-state number set: idle 0, happy 1, wave 2, thinking 3, sad 4, loading 5, listening 6, talking 7, sleeping 8 and attention 9. Your own file can use other numbers, as long as the map is written down.
| Placeholder in the app | State it stands for | Target number and name |
|---|---|---|
| CSS spinner or pulsing dot | Loading | 5, loading |
| Lottie checkmark or emoji tick | Success | 1, happy |
| CSS shake or red icon | Error | 4, sad |
| Static greeting image | Onboarding wave | 2, wave |
| Animated dots while the AI answers | Thinking | 3, thinking |
| Mic pulse on a voice screen | Listening | 6, listening |
| Speech bubble with a typing effect | Talking | 7, talking |
| Empty-state sleeping icon | Sleeping | 8, sleeping |
| Static logo or idle picture | Idle | 0, idle |
Two details shape the map. Rive Data Binding properties can be Number, String, Boolean, Color, Enum, Trigger, Image, nested View Model or List, so a mood is most simply one Number. A single spinner that also means an error is two states, not one class with a flag.
This set has no one-shot triggers, so success is shown with happy and error with sad. Keep those mappings explicit in the code so a reviewer can see why a success screen plays a happy state.
How do you connect an MCP server for the migration?
Charmotion's remote MCP server runs at https://charmotion.app/mcp over Streamable HTTP. It signs in with OAuth, so you do not paste an API key. Claude Code reads project servers from a .mcp.json file at the root of the repository, and its MCP documentation describes the JSON forms.
{\n \"mcpServers\": {\n \"charmotion\": {\n \"type\": \"http\",\n \"url\": \"https://charmotion.app/mcp\"\n }\n }\n}Charmotion's tools cover the Rive side of the migration. design_character draws a character with AI, or the agent can work from your own image. create_character_set generates the animations you choose, and add_animations adds more later. get_character_set returns download links and an AI_README with integration notes for coding assistants. export_videos makes video copies when you need them, and get_account shows what credits remain. Each character animation costs 1 credit, and idle is free. Current plan details are on the pricing page.
Before the agent writes binding code, ask it to read the AI_README from get_character_set. Those notes describe how the file expects to be driven, so the code follows the file rather than a guess.
How do you move one placeholder to a ViewModel, step by step?
Migrate one state at a time, starting with the one that appears most often, usually loading. Keep the old placeholder in place until its replacement passes the checks in the next section.
- Generate the file. Ask the agent to create a character set with the animations your map needs, such as loading, happy, sad and talking.
- Bind one state. Load the .riv in the runtime for your platform and get its bound ViewModelInstance. On web, the runtime exposes a viewModelInstance getter for the bound instance and a viewModel(path) method that returns one. In React Native, use useViewModelInstance; its async option needs @rive-app/react-native 0.4.18 or later.
- Route every write through one function. Put the map in one module and call it from every screen.
- Replace the placeholder on one screen. Keep the CSS or Lottie code until the new state passes review on that screen.
- Delete the old code. Remove the CSS class, the emoji and the Lottie import once nothing else uses them.
export const MOOD = {\n idle: 0,\n happy: 1,\n wave: 2,\n thinking: 3,\n sad: 4,\n loading: 5,\n listening: 6,\n talking: 7,\n sleeping: 8,\n attention: 9\n} as const;\n\n// One write path for every mascot state.\nexport function setMood(name: keyof typeof MOOD) {\n const value = MOOD[name];\n // write value to the mood number on the bound ViewModelInstance\n}Read the number back in a test to confirm the write happened. The event side of this pattern is covered in how to drive Rive character mood states from app state, and the steps for adding a state through MCP are in how to add new mood and animation states to a Rive character via MCP.
How do you check that each state reaches the Rive file?
A binding can look correct in code and still write to the wrong property. Check three things in the running app, not only in the editor.
- Name match. The property name in code must equal the name in the ViewModel. Write a value, read it back in a test, and fail the test if they differ.
- Runtime version. In Flutter 0.15.0, data binding happens when the RiveWidgetController is created, and the separate dataBind call was removed. That release needs Flutter 3.32.0 (Dart 3.8.0) or later. In the Apple runtime, v6.28.0 binds authored default instances automatically and deprecates DataBind.
- Default state. The character should show idle (0) before the first write, and loading should return to idle when the request finishes.
Open the file with the Rive file inspector before you wire anything, to confirm the ViewModel and its mood property exist under the names your code uses. For automated checks across screens, see testing MCP-generated Rive data binding states in Storybook and Playwright. Then check the verification that matters most to users: the screen still makes sense with reduced motion turned on, as covered in accessible animation and reduced motion.
How do you stop the agent from putting placeholders back?
Vibe-coded projects drift. The next prompt that asks for a loading spinner may write the CSS version again. Put the rule in the project's instruction file. Claude Code loads CLAUDE.md at the start of each session, and Cursor also reads it as a project instruction file.
A short rule works well: mascot states come from the Rive file, do not add CSS spinners or Lottie JSON for character states, and write state only through setMood in the mascot module. The full pattern is in writing CLAUDE.md and .cursorrules for Rive data binding mascot integrations.
If your mascot is a single character, Charmotion can produce the .riv file and its integration code through its MCP server, and the ViewModel pattern in this guide works with any Rive file your team builds.
How to migrate a vibe-coded app from CSS or Lottie placeholders to Rive Data Binding via MCP
- Inventory the placeholders. List every CSS class, Lottie file and static image that stands in for a character state, and note the screen where it appears.
- Map each state to a number. Give each placeholder one state name and one target number in a written table, with success and error mapped to states the file supports.
- Connect an MCP server. Add the remote MCP server URL to your coding agent and sign in with OAuth, so the agent can create and export the character file.
- Generate the file and read its notes. Ask the agent to create a character set with the animations your map needs, then have it read the integration notes before writing code.
- Bind one state and replace its placeholder. Load the .riv in the runtime, write the mood number through one function, and replace the placeholder on a single screen.
- Verify and remove the old code. Read each written value back in a test, check the default idle state, then delete the CSS, emoji and Lottie code that is no longer used.
Frequently asked questions
Do I need to delete all CSS and Lottie code at once?
No. Keep each placeholder until its replacement passes the checks on that screen. Each state should have one owner at a time, either the placeholder or the Rive file. Remove a Lottie package only after no screen imports it, since another page may still use it.
Can an agent change the .riv file after the app ships?
Yes. add_animations adds animations to an existing character, and only the new animations use credits. Ship the updated file as an asset update, then check that the mood numbers your code writes still match your map before release.
Which runtime versions should I check first?
Check the release notes for your runtime. Flutter 0.15.0 moved binding into RiveWidgetController creation and needs Flutter 3.32.0 or later. React Native's async useViewModelInstance option needs @rive-app/react-native 0.4.18 or later. Confirm the current latest version on each runtime's release page.
Sources
- Rive runtime parameters (web), Rive
- Rive React Native runtime, Rive
- Rive data binding property types, Rive
- Rive Flutter runtime migration guide, Rive
- dotLottie interactivity, LottieFiles
- Connect Claude Code to tools via MCP, Anthropic
Related guides
- How to Drive Rive Character Mood States (idle, happy, wave, loading) from App State
- How to Inspect and Verify MCP-Generated Rive Data Binding ViewModels in Code
- Writing CLAUDE.md and .cursorrules for Rive Data Binding Mascot Integrations
- Lottie vs Rive State Machines and Data Binding
- Rive Data Binding vs. State Machine Inputs: When to Use Each & Migration Guide