Skip to content

feat: slots, bezier paths, asset resolver and state machine parity with dotlottie-rs - #149

Merged
theashraf merged 10 commits into
mainfrom
feat/dotlottie-rs-parity
Nov 11, 2026
Merged

theashraf merged 10 commits into
mainfrom
feat/dotlottie-rs-parity

Conversation

@theashraf

@theashraf theashraf commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Stacked on #148. Wraps the parts of the dotlottie-rs C API that Kotlin could not reach, and moves the core to dotlottie-rs main (e5356051).

Core

New API (on DotLottieAnimation, DotLottieGLAnimation, DotLottieDrawable and DotLottieController)

  • Slots: getSlotIds(), getSlotType(id), getSlot(id), getSlots(), setSlot(id, json), resetSlot(id), resetSlots().
  • setBezierPathSlot(id, vertices, closed, inTangents?, outTangents?): replaces the geometry of a path slot. Null tangents mean straight segments.
  • State machine: stateMachineOverrideCurrentState(state, immediate), stateMachineResetInput(key), stateMachineGetInputs(), stateMachineStatus() and getStateMachine(id).
  • AssetResolver: supplies bytes for assets the player cannot load itself, such as an image referenced by a remote URL. Set it with Config.Builder.assetResolver() or the assetResolver parameter of the DotLottieAnimation composable.

Fixes

  • DotLottieAnimation.setLoopCount() did nothing: DotLottieDrawable.loopCount had no setter, so the value never reached the player.
  • Changing the config wiped slot overrides. Applying a config reset the theme whenever no theme was set, and resetting the theme discards slot overrides and theme data. So setLoop, setLoopCount, setPlayMode and every other config setter cleared the slots. The theme is now only set or reset when it differs from the active one. Found by running the React Native wrapper on an emulator.
  • Optional manifest fields such as an animation's name came back as the string "null". JSONObject.optString returns that for a JSON null.

Asset resolver notes

  • The core calls it synchronously on the thread that loads or renders, so the JNI trampoline attaches the thread when needed and clears any exception the resolver throws.
  • The core can keep calling a replaced resolver until its next load. The player therefore keeps every resolver's native context and frees them only after nativeDestroy.
  • It is wired through the software paths only (the view and the Compose composable), not the GL views.

Tests

  • PlayerParityInstrumentedTest in sample covers the new calls and the three fixes. 10 of 10 pass on an API 35 arm64 emulator against the rebuilt libraries.
  • The slot-override test fails without its fix and passes with it.
  • ./gradlew :dotlottie:assembleRelease builds all four ABIs.

Counterparts: LottieFiles/dotlottie-web#997, LottieFiles/dotlottie-ios#155.

cpal 0.16 (pulled in by rodio 0.21) replaced oboe with AAudio, which the
NDK only ships for API 26+, so libdotlottie_player.so no longer linked at
API 21. Each ABI now links a static libaaudio.a generated from the NDK's
AAudio.h: every entry point forwards to the real libaaudio.so through
dlopen/dlsym on first use. On Android 8+ calls reach the system library;
on older devices they return AAUDIO_ERROR_UNAVAILABLE and rodio reports
no output device, so the animation plays silently instead of the library
failing to load.
Bump deps/dotlottie-rs from v0.1.60 to 02a61130 (main after #623). This
brings rodio 0.21 with the audio-wav, audio-flac, audio-ogg and audio-m4a
features, the audio volume left-channel fix, typed bezier path slot
setters and the state machine forward-compat fixes.

Enable the four decoder features in the Gradle plugin defaults, the
dotlottieRust block and make/android.mk, rebuild all four ABIs, and bump
the version to 0.18.0.
Bring the Kotlin API up to the dotlottie-rs C API at 02a61130:

- getSlotIds, getSlotType, getSlot, getSlots, setSlot, resetSlot and
  resetSlots
- setBezierPathSlot
- an AssetResolver for assets the player cannot load itself, set through
  Config.Builder or the DotLottieAnimation composable
- stateMachineStatus and getStateMachine

All of them are available on the views, the drawable and the Compose
controller. No native rebuild: the JNI bridge links the same
libdotlottie_player.so (dotlottie-rs 02a61130, ThorVG v1.1.3).
@changeset-bot

changeset-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d800612

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

DotLottieDrawable.loopCount had no setter, so
DotLottieAnimation.setLoopCount() only wrote a field and never reached
the player.
Bump deps/dotlottie-rs to 1fd64fec (LottieFiles/dotlottie-rs#625), which
adds these three to the C API, and rebuild all four ABIs. ThorVG is
unchanged at v1.1.3.

Wrap them as stateMachineOverrideCurrentState, stateMachineResetInput
and stateMachineGetInputs on the views, the drawable and the Compose
controller.
LottieFiles/dotlottie-rs#625 was squash-merged. The tree is identical to
1fd64fec, which the libraries were built from.
@theashraf theashraf changed the title feat: slot introspection, bezier path slots and an asset resolver feat: slots, bezier paths, asset resolver and state machine parity with dotlottie-rs Nov 11, 2026
Applying a config reset the theme whenever no theme was set, and
resetting the theme discards slot overrides and theme data. So setLoop,
setLoopCount, setPlayMode and every other config setter wiped the slots.

Only set or reset the theme when it differs from the active one.
JSONObject.optString returns the string "null" for a JSON null, so
animation names, initial themes and the other optional manifest fields
came back as "null".
# Conflicts:
#	dotlottie/src/main/cpp/version.txt
#	dotlottie/src/main/jniLibs/arm64-v8a/libdotlottie_player.so
#	dotlottie/src/main/jniLibs/armeabi-v7a/libdotlottie_player.so
#	dotlottie/src/main/jniLibs/x86/libdotlottie_player.so
#	dotlottie/src/main/jniLibs/x86_64/libdotlottie_player.so
@theashraf
theashraf changed the base branch from chore/dotlottie-rs-0.1.61 to main November 11, 2026 05:47
@theashraf
theashraf marked this pull request as ready for review November 11, 2026 05:59
@theashraf
theashraf merged commit bb00b0e into main Nov 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant