I would like to have a soft/smooth color change at some value points of my RoundSlider. At the moment I have some hard color changes at the values 16, 20, 25 but that looks not very nice.
I tried to solve this with TweenLite, but I sadly did it not make to work... Do you have any other suggestions for me how I can solve this?
It would be okay with me to have a color transition from blue to red of the values 0 - 30, because the slider should be a input element for a thermostat.
Thank you!
$("#SetRoomTmpSlider").roundSlider({
sliderType: "min-range",
circleShape: "half-top",
startAngle: "315",
lineCap: "round",
radius: 130,
width: 20,
min: 5,
max: 30,
svgMode: true,
pathColor: "#eee",
borderWidth: 0,
startValue: 0,
valueChange: function (e) {
var color = "#0B77DD";
var logo = document.getElementById("SetRoomTmpSlider");
if(e.value >= 25)
{
color = "#ec2906";
}
else if (e.value >= 20)
{
color = "#EC7906";
}
else if (e.value >= 16)
{
color = "#ECB406";
}
$("#SetRoomTmpSlider").roundSlider({ "rangeColor": color, "tooltipColor": color });
}
});
var sliderObj = $("#SetRoomTmpSlider").data("roundSlider");
sliderObj.setValue(30);
#SetRoomTmpSlider .rs-handle {
background-color: #f3f3f3;
box-shadow: 0px 0px 4px 0px #000;
}
#SetRoomTmpSlider .rs-tooltip-text {
font-size: 25px;
font-weight: bold;
}
#SetRoomTmpSlider{
position: absolute;
top: 60%;
left: 50%;
margin: -100px 0 0 -150px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/round-slider@1.5.1/dist/roundslider.min.js"> </script>
</head>
<body>
<div id="SetRoomTmpSlider"></div>
</body>
</html>