Skip to content
SiteEmail

CSS transitions, CSS keyframes, SVG animations, WAAPI control, and sprite sheets should remain your default animation tools in Gameface. Animation libraries are useful when the UI needs designer-authored motion , complex timeline sequencing , or library-level callbacks that would be difficult to maintain with CSS alone.

In browser UI development, it is common to install an animation library as soon as a screen needs motion. In a game UI, that habit needs more discipline. JavaScript animation libraries calculate values on the JavaScript thread, usually on every animation frame. That work competes with input handling, state updates, data-binding updates, and any other UI logic running in the same view.

Gameface already gives you several native animation tools:

  1. CSS transitions for simple state changes like hover, focus, selected, disabled, or expanded.
  2. CSS keyframes for looping or multi-step effects that do not need runtime sequencing.
  3. WAAPI control for pausing, reversing, seeking, or replaying CSS-authored animations from JavaScript.
  4. Sprite sheets for pre-rendered VFX where the final visual should come from an offline art tool.

Reach for an animation library only when the project needs behavior that those tools do not express cleanly. Common examples include a long end-of-match results sequence, an onboarding flow with multiple timed callouts, or an After Effects animation exported by the motion design team.

The libraries below are documented as tested options that can run out of the box in Gameface, within the feature boundaries of the engine. Treat them as separate tools rather than interchangeable ways to move elements on screen.

  • Use Lottie when the source of truth is an After Effects composition exported as JSON. It is best for designer-authored vector motion that should play back as an asset.
  • Use GSAP when you need a maintained JavaScript timeline with sequencing, easing, callbacks, and runtime control across many DOM elements.
  • Use AnimeJS when you need a lighter JavaScript animation library for DOM element tweening, simple sequencing, or staggered effects.
  • Use Framer Motion when the UI is built in React and you want React-level animation primitives for components, variants, and transitions.
  • Fallback to CSS or WAAPI when the animation is a simple UI state transition, an idle loop, a loading pulse, or a basic panel entrance.

Other animation libraries may also work, but they have not been explicitly tested in the same way. If a library almost works and only depends on a small missing DOM method, a narrow polyfill can be reasonable. If it depends on a larger unsupported rendering feature, choose a different approach instead.

The tabs below show a minimal setup for each tested library and the Gameface-specific rules that matter most when using it.

Lottie usually refers to two related pieces: a JSON animation exported from After Effects, often through the Bodymovin plugin, and the JavaScript library that renders that JSON at runtime. Gameface officially supports Lottie Light , which renders through SVG and does not support expressions or effects.

Use Lottie when the animation should be owned by motion design rather than recreated by hand in CSS. Level-up bursts, reward reveals, stylized loaders, and branded transition moments are good candidates.

Install it through your package manager for project with bundlers (like Vite or Webpack):

Terminal
npm i lottie-web-light

For a direct script setup, download the Lottie Light build and serve it with the rest of your UI assets:

lottie-page.html
<script src="./vendor/lottie_light.js"></script>
<script src="./level-up-lottie.js"></script>

Start with a concrete container. Bodymovin usually generates an inline SVG with width="100%" and height="100%", so the parent element must have an explicit size:

LevelUpLottie.tsx
import { onMount } from 'solid-js';
import Block from '@components/Layout/Block/Block';
const LevelUpLottie = () => {
let containerRef!: HTMLElement;
onMount(() => {
const container = document.getElementById("level-up-lottie");
const animation = bodymovin.loadAnimation({
container,
path: "./assets/animations/level-up.json",
renderer: "svg",
loop: false,
autoplay: true,
});
// Snap playback to exported frames instead of interpolating subframes.
animation.setSubframe(false);
});
return <Block ref={containerRef} id="level-up-lottie" class="level-up-lottie" />;
};
lottie-container.css
.level-up-lottie {
width: 32vh;
height: 32vh;
}

Each library is limited by the same rendering and DOM capabilities as the rest of your Gameface UI. A library can provide timing, sequencing, easing, and callbacks, but it cannot make an unsupported CSS property, SVG feature, asset format, or browser API behave as if it were supported.

For GSAP, AnimeJS, and Framer Motion, the practical rule is simple: animate properties that Gameface already supports . Transforms, opacity, and supported dimensional properties are safer choices than library demos copied directly from browser-focused examples.

For Lottie, test the exported animation early in the Gameface Player. After Effects compositions can contain features that are valid in the Lottie ecosystem but outside the supported Gameface path, such as SVG filters, SVG blend modes, dynamic text, or unsupported embedded image formats.

For libraries not listed above, start with the smallest representative prototype. Test the exact property, SVG feature, DOM method, callback, or module format that your screen depends on. If the gap is small and local, such as a missing DOM convenience method, a focused polyfill may be enough. If the library depends on unsupported rendering behavior, a polyfill will not make that feature render correctly.