I made android platform Drawable which can draw animated Spine.
This is just proof of concept, that Spine can be used inside regular android ImageView or treat it as AnimatedDrawable. So we can swap the content while preserving the Android View. Which current spine-android-runtime could not do.
AndroidView(
factory = {
val view = ImageView(it)
val spine = AndroidSkeletonDrawable.fromAsset("spineboy.atlas", "spineboy-pro.json", it)
val drawable = SpineDrawable(spine)
view.setImageDrawable(drawable)
drawable.boundProvider = SkinAndAnimationBounds(listOf("default"),"idle")
spine.animationState.setAnimation(0, "idle", true)
drawable.start()
view
},
modifier = Modifier.background(Color.Cyan),
update = { }
)
It only need two files and official Spine-Android runtime library. You can find the source code from my gist
- Drawable ColorFilter setter is not tested