Start a new topic

change sprite sheet at runtime

change sprite sheet at runtime

I use an AnimatedImageDrawable to represent a monster. It plays a default animation infinitely. Now I want to play another animation when user clicks it. I tried change imageResource property to another sprite sheet, but no luck:

  monster.imageResource = new AR.ImageResource("assets/monster.lookaround.png");
  monster.animate(, 50, -1);

the monster just disappears.

I know I can put all animation frames into one single sprite sheet and use parameter to let animate method play specific frames. I didn't do that because wikitude fails to play it when the file is large enough. I've already posted another question about it yesterday.

How can I do it?

@wikitude stuff:

is it supported by design?

Hi Jack,
Did you try to create a second AR.AnimatedImageDrawable with it's own AR.ImageResource and replace the animated image drawable at runtime (either on your GeoObject or Trackable2DObject, depending on your use case). You can disable the animated image drawable that you currently don't need, so it's not rendered or animated.

Best regards,



I've tried that. It doesn't work either. The new AnimatedImageDrawable is blank(transparent) when set enabled=true. I'm not working on it recently. I'll try again when I have a chance.

Login or Signup to post a comment