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?
I have understood it is possible with flutter, but i don´t get how its done on javascript.
const r = new rive.Rive({
src: "email6.riv",
canvas: document.getElementById("canvas"),
autoplay: true,
artboard: "New Artboard",
stateMachines: "email_hover",
onLoad: () => {
r.resizeDrawingSurfaceToCanvas();
},
});
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- link rel="stylesheet" href="style.css" / -->
</head>
<body>
<canvas id="canvas" width="500" height="500"></canvas>
<script src="https://unpkg.com/@rive-app/[email protected]"></script>
</body>