Search Documentation
Search guides, functions, classes, interfaces, and more
Create a MobyApps splash screen
Scaffold a static HTML splash for native app startup. Uses @mobyapps/splash only — no @mobyapps/sdk or bridge. Author logic in src/main.ts (import from @mobyapps/splash and motion); pnpm build emits one minified classic dist/main.js via tsup (splash + Motion + app) and cssnano dist/styles.css.
Prerequisites
- Node.js 20+
- pnpm
- Install @mobyapps packages
Scaffold
pnpm create @mobyapps/splash@latest my-splash cd my-splash pnpm install pnpm dev
pnpm create @mobyapps/splash runs the @mobyapps/create-splash scaffold. The runtime library is @mobyapps/splash.
Scripts
| Command | Purpose |
|---|---|
pnpm dev | Watch + live reload on :8080 |
pnpm build | Compile static dist/ |
pnpm preview | Build once and serve |
Ship the dist/ folder.
Deploy modes
| Mode | How |
|---|---|
| A | Zip dist/ as splash.zip and embed in the native app build |
| B | Put contents under splash/ at the root of the boot miniapp archive (preferred when present) |
Native prefers B when present; otherwise A.
Animations with Motion
The scaffold depends on Motion and bundles it with your app and @mobyapps/splash into a single classic dist/main.js (tsup IIFE). Author against the ESM API in src/main.ts:
import { animate } from 'motion' import splash from '@mobyapps/splash' animate('#splash_el', { opacity: [0, 1] }, { duration: 0.45, ease: 'easeOut' }) animate('#splash_logo', { opacity: [0, 1], scale: [0.88, 1], y: [16, 0], }, { delay: 0.08, type: 'spring', stiffness: 260, damping: 20, })
<script src="main.js" defer></script>
Tips:
- Prefer CSS or a few Motion calls — keep an eye on size budget (
main.jsships Motion + splash + your code). - Run intro animation on load; keep the
updatehandler focused on progress /complete(see lifecycle). - Do not load Motion from a CDN — it must live inside the splash archive for offline cold starts.
- A smaller
motion/minipath is possible later if you drop independent transforms / rich springs.
Next steps
- Splash lifecycle —
update/completehandshake - Splash theming —
splash.themeand shared params - Splash performance — size budget
- Splash API