From 8c2436cdb7d27c2e922ccdb560a6ea516340b80a Mon Sep 17 00:00:00 2001 From: Andreas Hultgren Date: Wed, 15 Apr 2015 15:22:44 +0200 Subject: [PATCH] Tweaked vars for best visual effect --- source/js/thematrix.js | 9 ++++++--- source/less/main.less | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/source/js/thematrix.js b/source/js/thematrix.js index ee9512e..d6b0f2c 100644 --- a/source/js/thematrix.js +++ b/source/js/thematrix.js @@ -43,9 +43,9 @@ var killWhenDone = (elem, length) => { var getNormalizedLeft = (text) => { var i = parseInt(text.substring(0, 2), 16); - i = i || 0; + i = i || Math.floor(Math.random() * 16); i = i * width/256; - i += Math.random() * 30; + i += Math.random() * 40; i = Math.floor(i); return i; @@ -53,12 +53,15 @@ var getNormalizedLeft = (text) => { var createCol = (text) => { var col = $('
').addClass('col'); + var z = Math.floor(Math.random() * 4); text.split('').forEach(c => col.append(createChar(c))); col.css({ left: getNormalizedLeft(text), - top: Math.floor(Math.random() * height * 0.66) + top: Math.floor(Math.random() * height * 0.66), + 'z-index': z, + transform: `scale(${1/4*3 + z/4})` }); killWhenDone(col, text.length); diff --git a/source/less/main.less b/source/less/main.less index b92628c..e62c0aa 100644 --- a/source/less/main.less +++ b/source/less/main.less @@ -34,7 +34,7 @@ body { } @interval: 40ms; -@visible-for: 2000ms; +@visible-for: 3000ms; .animate-char (@n) when (@n > -1) { .animate-char(@n - 1);