WmMead

Project 13

This next iteration represents a small but significant change to these projects. I updated the fadeout function so that when the process of fading out elements is complete, there is a random chance of picking a different color scheme before adding elemtents again.

The effect this has is striking, because now instead of just getting a color scheme each time the program starts, the scheme can change at key points while the program is running. This leads to a wider array of possiblilities, while remaining true to the original esthetics.

Code Snippets for 13

Notice on line 17 where the color scheme is reset. This is a simple but effective way of getting more variety out of the designs that come up.
Updated fade function
function fade(element, counter) {
    var op = 1;  // initial opacity
	var countDown = counter;
    var timer = setInterval(function () {
        if (op <= 0.05){
            clearInterval(timer);
			container.removeChild(container.children[countDown]);
            countDown--;
			if( countDown > 0 )
			{
				fade(container.children[countDown], countDown);
			}
			else
			{
				// when it is done fading out, there is a chance of picking a differnt color scheme
				// for the next build up...
				colors = colorScheme[getRandomInt(0, 7)];
				//console.log(colors);
				createBox();
			}
        }
        element.style.opacity = op;
        element.style.filter = 'alpha(opacity=' + op * 100 + ")";
        op -= op * 0.05;
    }, 50);
}