Reputation: 161
I want a function that takes as input a hex color, and slowly change color, and then, in a loop, the output as input to do it. like the color picker, which will slowly change color with scroll-bars
for example reach rgb(232, 23, 23) from rgb(111, 232, 23)
Upvotes: 0
Views: 845
Reputation: 4704
I think RainbowVis-JS is what you are looking for:
$(function() {
var cur = 0;
var rainbow = new Rainbow();
rainbow.setNumberRange(0, 1000); // number of colors in the gradient
rainbow.setSpectrum('999999', 'd40d12');
setInterval(function() {
var color = rainbow.colourAt(cur);
console.log(color);
$('#color').css('background', '#' + color);
cur++;
}, 1);
});
#color {
width: 500px;
height: 500px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://raw.githubusercontent.com/anomal/RainbowVis-JS/master/rainbowvis.js"></script>
<div id="color"></div>
https://github.com/anomal/RainbowVis-JS
Upvotes: 2