JSFiddle - React, Tailwind, and code Playground

by Liam Hennessy

JavaScript

var c;
var n = 10;
var i_1, i_100, i_255, i_360 = 0;

for(var i = 0; i < n; i++)
{
    c = '.block-' + i;
    $('body').append('<div class="block block-' + i  + '">' + i + '</div>');
    
    /*
    	Generate values that interpolate using i along these ranges
        i_1     0.0 - 1.0
        i_100   0   - 100
        i_255   0   - 255
    */
    
    
    
    $(c).css('position', 'absolute');
    $(c).css('background-color', 'rgba(' + Math.floor((i / n) * 255) + ',' + i + ',' + i + ',' + 0.5 + ')');
    
    //$(c).css('width', i * 10);
}