Change sprite animation clip through code

Hi,
I have an entity that has 5-6 animation clips attached to it. Animation clips are basically sprite atlas sheets. It plays the default one. How do I play others? I can’t find any example.

Hi @Hassan_Amjad1!

Maybe the topics below can help you.

I got these clips attached to an entity but unable to change animation clip on runtime. The default one plays correctly.

It looks like it’s related to the topic below.

(request from Discord)

You can play any clip in the sprite component via https://api.playcanvas.com/classes/Engine.SpriteComponent.html#play and pass in the clip name

eg

this.entity.sprite.play('Clip 2')