From edc21f1fb34dd715f55b857c578e696a615bdceb Mon Sep 17 00:00:00 2001 From: Gustavo Adolfo Mesa Roldan Date: Tue, 5 Mar 2019 05:45:20 +0100 Subject: [PATCH] last of today --- index.html | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/index.html b/index.html index e1b9bc7..ce91f16 100644 --- a/index.html +++ b/index.html @@ -83,42 +83,38 @@ function rn(min, max){ return Math.floor(Math.random() * (max - min + 1) + min) } - var r = rn(0,255), - g = rn(0,255), - b = rn(0,255), + var c = [rn(0,255), rn(0,255), rn(0,255)], + r = rn(0,2), + direction = rn(0,1), letters, countLetter, thisLetter = 0; function colorizer(){ var time = 1; - - /* r = rn(0,255), - g = rn(0,255), - b = rn(0,255),*/ - if (r < 256){ - r++; - }else{ - if (g < 256){ - g++; + + now = $(letters[thisLetter]).html() + if (c[r] > 0 && c[r] < 255){ + console.log(direction); + console.log(c[r]); + console.log(c); + if(direction){ + c[r]++; }else{ - if (b < 256){ - b++; - }else{ - r = rn(0,255), - g = rn(0,255), - b = rn(0,255) - } - } + c[r]--; + } + }else{ + r = rn(0,2), + direction = !direction; + c[r] = c[r] >= 255 ? 250 : c[r] + c[r] = c[r] <= 0 ? 1 : c[r] } - now = $(letters[thisLetter]).html() - $(letters[thisLetter]).html("|") if (now != " " && now != "░"){ time = 50; now = "█"; - $(letters[thisLetter]).css({color: "rgb("+r+" ,"+g+" ,"+b+" )"}) + $(letters[thisLetter]).css({color: "rgb("+c[0]+" ,"+c[1]+" ,"+c[2]+" )"}) }else{ now = "░"; $(letters[thisLetter]).css({color: "white"})