Tiny glue that lets Raylib render .lottie archives or raw Lottie JSON as textures you can play, pause, seek by markers, and tint like any other sprite. Drop in dlrl.c / dlrl.h, link against dotlottie_player + raylib, and drive it from your game loop.
- Raylib 5.x and a C compiler (Clang or GCC). Prebuilt raylib binaries/headers live in
third_party/raylibfor macOS (arm64) and Linux (x86_64); the Makefile links against them by default. Bring your own raylib for other OS/arch layouts. - dotLottie runtime:
third_party/dotlottie_playerincludes headers and test prebuilts for macOS (arm64) and Linux (x86_64/arm64). For Android, iOS, Windows, or other platforms, grab the prebuilts from the dotlottie_player releases and drop them into the samelib/<os>/<arch>layout. - Assets:
.lottiebundles alongside the executable (e.g.,super-man.lottie). Avoid committing bulky test assets.
make build # builds dlrl + sample into build/example
make run # runs with super-man.lottie
make run ASSET=foo.lottie # run any .lottie or .json
make clean # wipe build/Adjust INCLUDES / LIB_DIRS in the Makefile if you swap in your own raylib/dotLottie SDKs or install them outside the bundled layout.
- Bundled raylib and dotLottie binaries are for local testing only. Replace them with the correct libraries from upstream releases for your target OS/arch (including Android/iOS), then rebuild with
make clean && make build. - The Makefile picks subdirectories of
third_party/dotlottie_player/lib/<os>/<arch>andthird_party/raylib/lib/<os>/<arch>based on your host. If nothing matches, it errors and points you at the releases. - Raylib is looked up in
third_party/raylib/lib/<os>/<arch>; drop in the right build if you’re on a different platform.
- Copy
dlrl.canddlrl.hinto your project. - Add
third_party/dotlottie_player/includeandthird_party/raylib/includeto your compiler include paths; add the matchingthird_party/dotlottie_player/lib/<os>/<arch>andthird_party/raylib/lib/<os>/<arch>to your linker search paths. - Link with
-ldotlottie_player -lraylibplus platform libs (OpenGL/Cocoa on macOS, X11/GL/pthread on Linux). - Drive the player inside your Raylib loop:
dlrl_Config cfg = {
.loop = true, .speed = 1.0f,
.fit = DLRL_FIT_CONTAIN, .align = (Vector2){0.5f, 0.5f},
.background = BLANK
};
dlrl_Player* p = dlrl_LoadDotLottieFile("hero.lottie", &cfg);
dlrl_Play(p);
// in your frame:
dlrl_Update(p, GetFrameTime());
dlrl_Draw(p, (Rectangle){x, y, w, h}, 0.0f, WHITE);- Switch animation/theme/state machine at runtime via
dlrl_SetAnimation,dlrl_SetTheme, anddlrl_SetMarker. - Enumerate markers with
dlrl_MarkerCount/dlrl_MarkerName; the sample maps marker names to keys (example.c). dlrl_SetModecovers forward, reverse, bounce, and reverse-bounce;dlrl_SetLoopanddlrl_SetSpeedadjust looping and time scale.
- Link errors about dotLottie: ensure the correct
third_party/dotlottie_player/lib/<os>/<arch>exists for your CPU/OS and matches your compiler target. - Blank render: call
dlrl_Updateevery frame, pass a non-zero destination rectangle, and trydlrl_SetMarker(p, NULL)to play the full timeline.
