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

Fixing Hard Jump-Cuts Between Mascot Animations With Rive State Machines

By the Charmotion team · Updated · How we write guides

Cover illustration for the guide: Fixing Hard Jump-Cuts Between Mascot Animations With Rive State Machines, with Charmotion demo characters

To fix jump cuts when switching AI mascot video clips in app UI, stop swapping separate video clips and play one rigged Rive file instead. A Rive state machine holds the idle, happy, loading and other states, and your app changes a number or boolean input so the character blends from one state to the next inside the same file.

Key takeaways

  • Jump cuts happen because each AI clip is a separate file that starts and ends on different poses.
  • One .riv file with a state machine keeps every state on the same character, so a switch becomes a transition.
  • Use number or boolean inputs for states the app must hold, and triggers only for one-shot events.
  • Route every state through a neutral idle pose and test each pair of states, not just idle to one state.
  • If you must keep video, match end and start frames, preload the next clip and crossfade.

Why do AI mascot clips jump when the app switches them?

A jump cut appears when the screen changes from one picture to a different one with no movement in between. With AI mascot video, the usual cause is that every state is its own clip. The idle clip ends with the mascot leaning to one side, the happy clip starts with it upright, and the player swaps one for the other on the next frame.

Three things make this worse inside an app:

  • Different start and end poses. Each clip is generated on its own, so the first frame of one clip rarely matches the last frame of another.
  • Loading gaps. A video element may need time to buffer the next file, which shows as a freeze, a flash of the poster image or a blank frame.
  • Looping seams. An idle loop made from AI video often drifts slightly between its last and first frame, so the loop itself jumps once per cycle.

Editing the clips in a video editor can soften one cut, but the app still has to swap files at runtime. The durable fix is to stop swapping files and keep one character that changes state inside the file.

How to fix jump cuts when switching AI mascot video clips in app UI?

Use one Rive file for the mascot and put each state in a state machine. The character is a single set of shapes and bones, so every state starts from the pose the previous state left. A change becomes a transition that the runtime blends over a short time, instead of a cut between two separate videos.

The workflow is the same whether the character started as AI art, a flat illustration or a sketch:

  1. Rig the mascot once in the Rive editor, with an idle loop and one animation for each state the UI needs.
  2. Add a state machine with a state for each animation and transitions between them.
  3. Expose a number or boolean input that your app sets.
  4. Export one .riv file and load it with the runtime for your platform.

Exports from Rive's free plan play a Rive splash screen, and paid plans export without it, so check the plan before you ship. Our guide to whether Rive is free covers the commercial side. For the file structure itself, read how Rive state machines work.

How do Rive state machine inputs control the mascot?

Rive state machine inputs are the values that drive transitions. Rive's help documentation describes three types: a number (a float value), a boolean (true or false) and a trigger (a one-shot signal). Changing a boolean or number input moves the character toward the state its transitions point to, and firing a trigger runs a transition once.

Input typeWhat it holdsGood use for a mascot
NumberA float valueA mood or level, such as 0 for idle and 5 for loading
Booleantrue or falseAn on or off state, such as listening
TriggerA one-shot signalA tap or a reset that should happen once

Use a number when states form a set of moods, and a boolean when a state is simply on or off. Reserve triggers for events. A trigger suits a tap, but it is a poor fit for loading, because loading should hold until a request finishes and a trigger fires only once.

Each runtime reads the inputs a little differently:

  • Web: list a state machine's inputs with stateMachineInputs and the state machine name, then find your input by name. Boolean and number inputs expose a value property you can set, and triggers are fired by calling a method on them.
  • Android: the runtime provides one setter per input type, called through the view.
  • Flutter: create the state machine controller from an artboard and a state machine name, then read the inputs from controller.stateMachine.inputs.
  • React: the useStateMachineInput hook takes the Rive instance, the state machine name and the input name. The React runtime page marks this hook as deprecated in favour of newer data binding hooks, so check the current hook before you build.

How do you set up transitions so no state jumps?

Transitions decide what the character does when an input changes. Each transition has a condition that reads an input, such as mood equals 5, and a blend time that sets how long the change takes. A short blend makes the change read as motion. A zero blend reads as a cut, which is the problem you are trying to remove.

Use idle as the hub. Every state returns to the neutral idle pose before it goes anywhere else, so the character never has to jump from a sad pose straight to a celebrating one. A simple mapping for a loading, success and error flow might look like this:

Mood numberStateTransition from idle
0idleDefault and return point
1happyCondition mood = 1, short blend
4sadCondition mood = 4, short blend
5loadingCondition mood = 5, holds until the input changes

Test every pair of states, not just the common path. Set the input to each value in turn, from each state, and watch for pose snaps. A pair that looks fine from idle can snap when a loading state is interrupted by a happy one, and that is the case to fix in the transitions before release.

Keep the number of states small. Five or six states that the UI really uses are easier to keep smooth than fifteen that appear once in a while. For a deeper look at moods, see mascot animation states.

What does the app code look like for switching states?

The pattern is the same on every platform: load the file once, keep a reference to the input, and write a value when app state changes. This web example uses a number input named mood on a state machine called CharacterStateMachine. Replace the names with the ones in your file.

const rive = new Rive({
  src: '/mascot.riv',
  canvas: document.getElementById('mascot'),
  autoplay: true,
  stateMachines: 'CharacterStateMachine',
});

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

async function askAssistant(prompt) {
  setMood(5);
  const reply = await send(prompt);
  setMood(1);
  return reply;
}

Notice that the code never swaps a source file. It changes one value, and the runtime moves the character. The same idea applies to a boolean input for a listening state, or to a trigger for a single tap reaction.

When the mascot must react to data, bind the state to app state in one place. Set it from your store or from the request lifecycle, not from scattered click handlers, so loading, success and error always move through the same transitions. The guide to driving mood states from app state shows that structure in more detail.

What if the mascot has to stay a video?

Sometimes the mascot exists only as video, for example an AI clip you cannot rig. In that case the goal is to make the cut as hard to see as possible, and the usual steps are:

  • Match frames. Trim each clip so its last frame is close to the first frame of the clip that follows it.
  • Preload. Load the next clip before the switch so the swap does not wait on the network.
  • Crossfade. Stack two video elements and fade opacity over a short period, instead of hiding one and showing the other.
  • Keep canvas size equal. Use the same frame size and position for every clip so the mascot does not shift.

Transparent clips add another rule. Chromium-based browsers and Firefox display the alpha channel of a VP9 WebM, while Safari has been reported to ignore it, so a transparent HEVC MOV with alpha is the usual Safari fallback. A crossfade hides a cut but does not remove it, so treat it as a fallback. If you need the character to respond to app state, a single rigged file is the better design. Charmotion turns one front-facing character image into a Rive file with a CharacterStateMachine and a number input named mood, and its moods blend into each other, so the code above is the whole switching layer. See Charmotion plans for what each plan includes.

How to replace AI mascot video clips with one Rive state machine

  1. List the states. Write down every mascot state the UI needs, such as idle, happy, loading and sad, and give each one an animation in the Rive editor.
  2. Rig the character once. Build the mascot as one artboard, using the idle loop as the neutral hub that every other state returns to.
  3. Add a state machine input. Create a number input named mood, or one boolean input per state, on the state machine.
  4. Connect the transitions. Add transitions from idle to each state and back, with a short blend time and a condition that reads the input.
  5. Export one .riv file. Export a single .riv file and load it with the Rive runtime for your platform, without swapping video sources.
  6. Set state from app code and test pairs. Write the input from app state when requests start and finish, then set every pair of states and check for pose snaps.

Frequently asked questions

Can I fix a jump cut with a crossfade alone?

A crossfade hides a cut by blending two clips over a short time, so it helps when you must keep video. It does not make the poses match, and loops still reset. For a mascot that changes state often, a single rigged file with state machine transitions gives smoother results and needs fewer files to load.

Does Rive's free plan work for a shipped app?

Exports from Rive's free plan play a Rive splash screen, while paid plans export without it. Check the current plan details on Rive's pricing page before you ship, and read the guide on whether Rive is free for the commercial terms that apply.

Should loading be a trigger or a number input?

Use a number or boolean input for loading. Loading has to hold until the request ends, and a trigger fires once and then the transition is done. Set the input to loading when the request starts and back to a result state when it resolves.

Sources

Related guides