javascript - How to update the color of an already rendered Body in Matterjs -
i have body added world. want update color.
var ball = bodies.circle(xposition, yposition, 25, { force: { x: rand(-0.0005, 0.01), y: -0.01 }, restitution: 0.75, render: { fillstyle: '#a87fb5', }, }); world.add(world, [ ball, ]); i have tried:
body.set(ball, fillstyle, '#754c82'); body.set(ball, render.fillstyle, '#754c82'); body.set(ball, {render: {fillstyle: '#754c82'}}); i suspect i'm using wrong approach. unless i've overlooked it, can't find in documentation how update this.
apparently 1 of properties can reach in , change
ball.render.fillstyle = '#754c82';
Comments
Post a Comment