0

Is it possible to change the parameters of the Rive animation elements in android programmatically?

I have a Rive animation, I need to change the color of one of its elements programmatically. I didn't find anything in the documentation and samples for Rive.

1 Answers1

0

I do be able to control Rive animation using

            if(binding.bus.isPlaying) {
                binding.bus.controller.pause()
            }
            else {
                binding.bus.controller.play()
            }

or change Rive source

            val queue = Volley.newRequestQueue(context)
            val stringRequest = RiveFileRequest(
                "https://cdn.rive.app/animations/vehicles.riv",
                { file -> binding.bus.setRiveFile(file) },
                { throw IOException("Unable to download Rive file") }
            )
            queue.add(stringRequest)

More you can see the source code from here: https://github.com/rive-app/rive-android/blob/master/kotlin/src/main/java/app/rive/runtime/kotlin/RiveAnimationView.kt#L625

River2202
  • 1,225
  • 13
  • 22