Forum Discussion
MarcelLendi-0d9
6 months agoCommunity Member
Help needed: Changing the color of an object with javascript
I like to create an object (e.g., a rectangle) and change its color using 3 sliders (RGB). I read the slider values into Javascript and calculate the Hexadecimal value. I found this calculation on h...
JohnCooper-be3c
6 months agoCommunity Member
Hi Marcel
You should be able use the GSAP Animation JavaScript code library which is integrated into Storyline. You will need to find the ID of the rectangle you want to change but then it will be something like:
gsap.to('#shapeID', {
duration: 1, // Duration in seconds
backgroundColor: "#00ff00", // Target color in hex format
ease: "none" // Type of easing
});
There are way better experts here that use GSAP regularly that will be able to correct my code if it's wrong - but definitely GSAP will do it.