Vai al contenuto
Offerta a tempoStarter ora costa 9 USD al mese invece di 20 USD.Vedi i piani
charmotion

Prompt AI per aggiungere una mascotte animata alla splash o al caricamento

A cura del team di Charmotion · Aggiornato il · Come scriviamo le guide

Illustrazione di copertina della guida: prompt AI per aggiungere una mascotte animata alla splash screen o al caricamento, con i personaggi demo di Charmotion

Gli strumenti di coding AI come Cursor, Claude Code, Lovable, Bolt e v0 possono aggiungere una mascotte animata alla splash screen o al caricamento, se il prompt indica ciò che di solito sbagliano: la splash del sistema operativo resta statica, l'intro si riproduce sulla prima schermata, il nome esatto della state machine, un timer di 2,6 secondi perché il file non emette alcun evento di fine, un solo colore di sfondo e un'alternativa per il movimento ridotto.

Punti chiave

  • Incolla il blocco di regole comuni nel prompt o nelle regole del progetto, così ogni strumento riceve gli stessi dati.
  • Di' allo strumento che la launch screen del sistema operativo deve restare statica; altrimenti potrebbe provare ad animarla.
  • Specifica che il file di avvio non emette alcun evento di fine, altrimenti lo strumento inventerà una callback che non scatta mai.
  • Indica framework, pacchetto e percorsi dei file; i prompt vaghi producono codice Lottie per un file .riv.
  • Controlla il risultato con una breve checklist: colore coerente, timer, timeout di sicurezza, movimento ridotto.

Hai già un personaggio o un logo? Guarda gli esempi in vere schermate di app: splash screen, onboarding, schermate di caricamento ed empty state, con l'animazione che si riproduce in ognuna.

Perché gli strumenti di coding AI sbagliano le splash screen animate?

Perché la risposta più comune nei loro dati di addestramento è quella sbagliata per la tua app. Chiedi "una splash screen animata" senza dettagli e spesso ottieni una di queste:

  • Un tentativo di mettere un'animazione in LaunchScreen.storyboard, che può usare solo classi UIKit standard senza collegamenti al codice (Apple).
  • Un componente Lottie puntato su un file .riv, oppure una nuova libreria di animazione che non avevi chiesto.
  • Un listener per un evento "animazione terminata" che il file non emette mai, così l'app resta bloccata sull'intro.
  • Codice Rive eseguito in Expo Go, che non può caricare moduli nativi (Rive).
  • Un lampo bianco, perché splash, vista principale e intro usano colori diversi.
  • Nessuna gestione del movimento ridotto.

La soluzione è dare subito i dati allo strumento. Mettili in istruzioni di progetto persistenti, così non devi ripeterli: Claude Code legge CLAUDE.md e può leggere AGENTS.md (Claude Code Docs), Cursor legge le regole di progetto in .cursor/rules come file .mdc e supporta AGENTS.md (Cursor Docs), e Lovable ha una Knowledge di workspace e di progetto sempre presente nel contesto (Lovable Docs). Per Bolt e v0, incolla le regole all'inizio della chat.

Quali regole deve includere ogni prompt per la splash screen?

Incolla questo blocco prima di uno qualsiasi dei prompt per framework qui sotto e sostituisci i valori tra parentesi quadre. Presuppone un file di avvio Charmotion (LaunchStateMachine, intro di 2,6 secondi, nessun evento di fine); se il tuo file è diverso, modifica quelle righe.

Rules for the launch animation (follow exactly):
- The OS launch screen stays static. Do not try to animate
  LaunchScreen.storyboard, UILaunchScreen, the Expo splash config
  or flutter_native_splash. The animation plays on the FIRST SCREEN.
- Asset: [assets/launch.riv]. State machine: "LaunchStateMachine".
  It plays a 2.6 s intro once and settles on the resting icon.
- The file fires NO end event. Do not listen for "introDone",
  "onComplete" or any other event. Wait 2.6 s with a timer, then
  continue. Add a 4 s safety timeout in case the file fails to load.
- Background color [#0E1116] must be identical on the native
  splash, the root view and the intro screen (light and dark).
- Show the intro at the same size and center position as the icon
  on the native splash, so there is no visible jump.
- Reduced motion: if the user has it enabled, skip the intro and
  show the still icon [assets/icon_rest.png], then continue.
- Never block the app longer than the intro. Do not add extra delay.
- Do not add Lottie or any other animation library.

Perché la regola del timer è importante: una state machine di Rive emette solo gli eventi che il suo autore ha previsto. Un file di avvio Charmotion si riproduce una volta, si ferma sulla posa di riposo e non emette nulla, quindi l'unico modo corretto per proseguire è aspettare la sua durata. Dire allo strumento di non inventare un nome di evento evita il blocco più comune.

I download di Charmotion includono anche codice web, React e SwiftUI accanto al .riv, così puoi allegare al prompt un esempio funzionante invece di descriverlo.

Quale prompt aggiunge una splash animata in SwiftUI?

Per Cursor o Claude Code in un progetto Xcode:

Add a launch intro to this SwiftUI app.

[paste the rules block]

Details:
- Add the RiveRuntime Swift package (rive-ios) if it is missing.
- Bundle launch.riv in the app target.
- Create LaunchIntroView: full-screen Color("LaunchBackground"),
  centered 160x160 RiveViewModel(fileName: "launch",
  stateMachineName: "LaunchStateMachine").view().
- In the App struct, show LaunchIntroView over ContentView with a
  @State showIntro = true. After 2.6 s (Task.sleep), set it to false
  with a 0.25 s opacity transition.
- Read @Environment(\.accessibilityReduceMotion). If true, do not
  show the intro at all.
- Set UILaunchScreen in Info.plist: UIColorName = LaunchBackground,
  UIImageName = IconRest (same size as the intro's icon).
- Do not modify LaunchScreen.storyboard beyond static views.
Show me the files you changed.

La versione completa scritta a mano, incluso il nuovo runtime Apple di Rive, è in splash screen animata in SwiftUI.

Quale prompt aggiunge una splash animata in Expo o React Native?

Add an animated launch intro to this Expo app (Expo Router).

[paste the rules block]

Details:
- Use expo-splash-screen: call SplashScreen.preventAutoHideAsync()
  in global scope in app/_layout.tsx. Call SplashScreen.hideAsync()
  only after the Rive file has loaded.
- In app.json, set the expo-splash-screen plugin backgroundColor,
  image (assets/icon-rest.png), imageWidth 160 and dark options, and
  the same root "backgroundColor". Install expo-system-ui if needed.
- Use @rive-app/react-native with react-native-nitro-modules, installed
  with npx expo install. This needs a development build, not Expo Go.
- Add "riv" to resolver.assetExts in metro.config.js.
- Create components/LaunchIntro.tsx: useRiveFile(require(...)),
  RiveView with stateMachineName="LaunchStateMachine", autoPlay,
  160x160, centered on the background color. Call onDone after
  2600 ms with setTimeout. Add a 4000 ms safety timeout.
- Check AccessibilityInfo.isReduceMotionEnabled(); if true, hide the
  splash and call onDone immediately.
- Do not use Lottie. Do not listen for any Rive event.

Approfondimenti su ogni passaggio: splash animata in Expo e React Native e Rive in Expo.

Quale prompt aggiunge una splash animata in Flutter?

Add an animated launch intro to this Flutter app.

[paste the rules block]

Details:
- Keep flutter_native_splash for the native splash (color [#0E1116],
  image assets/icon_rest.png). It stays static.
- In main(): binding = WidgetsFlutterBinding.ensureInitialized();
  FlutterNativeSplash.preserve(widgetsBinding: binding);
  await RiveNative.init();
- Add the rive package. Create IntroPage (StatefulWidget) as home:
  load File.asset('assets/launch.riv', riveFactory: Factory.rive),
  create RiveWidgetController with
  StateMachineSelector.byName('LaunchStateMachine'), render
  RiveWidget in a 160x160 SizedBox centered on the background color.
- Call FlutterNativeSplash.remove() after the file loads, wait
  2600 ms, then Navigator.pushReplacement to the existing home page.
- If MediaQuery.disableAnimationsOf(context) (or
  platformDispatcher.accessibilityFeatures.disableAnimations) is true,
  show Image.asset('assets/icon_rest.png') and navigate immediately.
- Dispose the controller and the file in dispose().

Lo stesso codice, scritto per intero e spiegato: splash screen animata in Flutter.

Quale prompt aggiunge un'intro animata in Next.js, Lovable, Bolt o v0?

Le web app non hanno una splash del sistema operativo, quindi l'equivalente è una sezione hero o un'intro al primo caricamento. Lovable, Bolt e v0 di solito generano React, quindi un solo prompt va bene per tutti:

Add an animated logo intro to the hero of this React / Next.js page.

Assets (in /public):
- logo-intro.webm (VP9 with alpha), logo-intro.mov (HEVC with alpha),
  logo-rest.webp (the still final frame, same size).

Rules:
- Render a <video autoplay muted playsinline> with poster="/logo-rest.webp",
  fixed width and height (no layout shift), and two sources in this
  order: logo-intro.mov with type 'video/mp4; codecs="hvc1"', then
  logo-intro.webm with type "video/webm".
- Do not loop. When it ends, keep the last frame (it matches the poster).
- If play() rejects, keep showing the poster.
- With prefers-reduced-motion: reduce, render only the poster image.
- In Next.js, make the component a client component.
- Do not add Lottie, GSAP or any other animation library.

Per una mascotte interattiva sul web invece di un video, chiedi @rive-app/react-webgl2 con stateMachine: "CharacterViewModelMachine" e autoBind: true (Rive). L'ordine delle sorgenti e i codec seguono l'approccio cross-browser di Jake Archibald (Jake Archibald); leggi video con sfondo trasparente su un sito web.

Quale prompt aggiunge una mascotte di caricamento invece di una splash?

Lo stesso file del personaggio può gestire gli stati di caricamento. Questo prompt presuppone la struttura del file delle regole qui sopra (un view model Character); rinomina le proprietà in base alle tue:

Show the mascot while [the image generation request] is pending.

- File: [assets/character.riv]. State machine: "CharacterViewModelMachine".
  View model "Character" with a number property "mood". It has
  no triggers.
- Mood values: 0 idle, 1 happy, 4 sad, 5 loading.
- Before the request: set mood = 5. On success: set mood = 1,
  then back to 0 after 1.5 s. On failure: set mood = 4 and show
  the error text.
- Only show the mascot if the request takes longer than 600 ms.
- Keep visible "Loading…" text with role="status" (web) or an
  accessibility label (native). Hide the animation itself from
  screen readers.
- Reduced motion: show the still image and the text, no animation.
- If the file has no "Character" view model, fall back to the
  legacy "CharacterStateMachine" with the same number input "mood".

Altro su tempi e accessibilità dei loader in come aggiungere un'animazione di caricamento.

Come controlli quello che ha scritto lo strumento AI?

Verifica questi punti prima del merge:

  1. La splash del sistema operativo è intatta o statica. Nessun codice nello storyboard di avvio, nessun drawable animato fuori da drawable-v31 su Android.
  2. Un solo colore di sfondo per splash, vista principale e intro, in modalità chiara e scura.
  3. Un timer, non un evento inventato, chiude l'intro, più un timeout di sicurezza.
  4. La splash si nasconde dopo il caricamento del file, non prima (nessun frame vuoto).
  5. Il movimento ridotto salta l'intro (verifica con l'impostazione di sistema attiva, usando prefers-reduced-motion sul web) (MDN).
  6. Nessuna dipendenza a sorpresa. Rimuovi qualsiasi libreria che lo strumento ha aggiunto di sua iniziativa.
  7. Testato su una build di release per Expo, e su un dispositivo reale per tutte le piattaforme.

Domande frequenti

Qual è il miglior strumento di coding AI per aggiungere un'animazione alla splash screen?

Lo strumento conta meno del prompt. Cursor e Claude Code lavorano dentro il tuo progetto nativo o Expo esistente; Lovable, Bolt e v0 danno il meglio con le web app in React. Ognuno di loro riesce se gli dai i nomi delle state machine, la durata fissa dell'intro, il colore di sfondo comune e la regola sul movimento ridotto.

Perché l'intro della splash generata con l'AI non finisce mai?

Di solito perché il codice aspetta un evento di fine che il file di animazione non emette. Una LaunchStateMachine di Charmotion non emette alcun evento quando la sua intro di 2,6 secondi finisce. Sostituisci il listener con un timer di 2600 ms e aggiungi un timeout di sicurezza, così l'app prosegue sempre.

Devo mettere le regole della splash in CLAUDE.md o nelle regole di Cursor?

Sì, se più di una persona o di una sessione metterà mano al flusso di avvio. Claude Code carica CLAUDE.md (e può leggere AGENTS.md) a ogni sessione, e Cursor applica le regole .mdc da .cursor/rules, così le regole su timer, colore e movimento ridotto restano valide a ogni modifica.

Risposte rapide da questa guida

Fonti

Guide correlate