rive-webgl icon indicating copy to clipboard operation
rive-webgl copied to clipboard

Change color in RIVE

Open markushedin opened this issue 1 year ago • 2 comments

I'm looking to dynamically change the color of an object in my Rive file directly through my JavaScript code. Does anyone know if this is possible?

My javascript:

`const r = new rive.Rive({ src: "email6.riv", canvas: document.getElementById("canvas"), autoplay: true, artboard: "New Artboard", stateMachines: "email_hover",

onLoad: () => { r.resizeDrawingSurfaceToCanvas(); }, }); `

markushedin avatar Jan 25 '24 17:01 markushedin

its been a long time since i've used Rive, but i think you can attach the colour of an object to some state and changing it using javascript would result in change in colour

iamargentum avatar Jan 25 '24 17:01 iamargentum

Yes, but I was considering whether it's possible to dynamically change to any HEX code within the code not depending in the RIVE file?

markushedin avatar Jan 26 '24 07:01 markushedin