liabru / matter-js

a 2D rigid body physics engine for the web ▲● ■
MIT License
16.79k stars 1.96k forks source link

Is it possible to implement sprite looping animation? #1291

Open JeongWuk opened 5 months ago

JeongWuk commented 5 months ago
const guideLine = Matter.Bodies.rectangle(
      render.options.width / 2,
      render.options.height / 2,
      5,
      render.options.height / 2,
      {
        name: 'guideLine',
        isStatic: true, 
        isSensor: true, 
        collisionFilter: { group: -1 }, 
        render: {
          sprite: {
            texture: dotted[0].image,
            xScale: game_wrap.clientWidth / 450,
            yScale: game_wrap.clientHeight / 1226
          }
        }
      }
    )

I made a guideLine object which is a dotted line image, i want to make the sprite animate like a infinite swiper. Is it possible?

ggorlen commented 3 months ago

Please see matter.js: is there any way to animate my sprite on Stack Overflow. If this doesn't work for you, share a complete example of your code and use case.