3

I'm getting mad trying to figure out how to put an animated image into a Bodies.rectangle. I've animated the image with CSS and I have a gif version of the image that I want to use. How can I do it?

var char = Bodies.rectangle(90, 549, 84, 78, {
  isStatic: true,
  render: {
    sprite: {
      texture: 'http://i57.tinypic.com/3343zwi.png'
    }
  }
});

This is my declaration of the body that I want to use. Should I use Matter.js for this kind of thing?

ggorlen
  • 44,755
  • 7
  • 76
  • 106
Malignus
  • 115
  • 1
  • 13
  • Maybe @liabru could help? – WhiteHotLoveTiger Jan 25 '16 at 17:05
  • The built-in MJS renderer isn't really suited for this sort of task--it's mainly for prototyping. Try plugging MJS into a rendering engine that supports spritesheets and animations natively, for example Phaser, HTML5 canvas, etc. [This answer](https://stackoverflow.com/questions/65207865/matter-js-is-there-any-way-to-animate-my-sprite/65301374#65301374) may help. – ggorlen Dec 15 '20 at 07:08
  • Does this answer your question? [matter.js: is there any way to animate my sprite](https://stackoverflow.com/questions/65207865/matter-js-is-there-any-way-to-animate-my-sprite) – ggorlen Jan 03 '21 at 16:39

0 Answers0