Skip to content
This repository has been archived by the owner on Feb 20, 2019. It is now read-only.

Commit

Permalink
Slightly sorted columns
Browse files Browse the repository at this point in the history
  • Loading branch information
ahultgren committed Apr 15, 2015
1 parent 8b8c208 commit 90c1a30
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion source/js/thematrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,24 @@ var killWhenDone = (elem, length) => {
}, length * 200 + 2000);
};

var getNormalizedLeft = (text) => {
var i = parseInt(text.substring(0, 2), 16);

i = i || 0;
i = i * width/256;
i += Math.random() * 30;
i = Math.floor(i);

return i;
};

var createCol = (text) => {
var col = $('<div/>').addClass('col');

text.split('').forEach(c => col.append(createChar(c)));

col.css({
left: Math.floor(Math.random() * width),
left: getNormalizedLeft(text),
top: Math.floor(Math.random() * height * 0.66)
});

Expand Down

0 comments on commit 90c1a30

Please sign in to comment.