commit 0feaf568e93884328943cdeef1f073b852eb0b59 Author: Tyler Hallada Date: Wed Jul 4 19:24:29 2018 -0400 Done diff --git a/billboard.js b/billboard.js new file mode 100644 index 0000000..0bf5227 --- /dev/null +++ b/billboard.js @@ -0,0 +1,54 @@ +function genRandomText(length) { + var text = ""; + var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 .?-!(),\"'"; + + for (var i = 0; i < length; i++) + text += possible.charAt(Math.floor(Math.random() * possible.length)); + + return text; +} + +function genRandomInt(min, max) { + // inclusive min & max + return Math.floor(Math.random() * (max - min + 1)) + min; +} + +function shiftArrayToRight(arr, places) { + for (var i = 0; i < places; i++) { + arr.unshift(arr.pop()); + } +} + +function textFillsScreen() { + var root = document.compatMode == 'BackCompat' ? document.body : document.documentElement; + return root.scrollHeight > root.clientHeight; +} + +function fillScreenWithWhitespace() { + var text = document.getElementById("text"); + var charArray = [" "]; + var whitespace = "               "; + while(!textFillsScreen()) { + text.innerHTML += whitespace; + charArray.push.apply(charArray, [" ", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", " ", " ", " "]); + } + for (var i = 0; i < 26; i++) { + text.innerHTML += whitespace; + charArray.push.apply(charArray, [" ", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", " ", " ", " "]); + } + return charArray; +} + +window.onload = function () { + var textElem = document.getElementById('text'); + var charArray = fillScreenWithWhitespace(); + window.setInterval(function () { + for (var i = 0; i < genRandomInt(1, 4); i++) { + charArray[genRandomInt(0, charArray.length - 1)] = genRandomText(1); + textElem.innerHTML = charArray.join(""); + } + shiftArrayToRight(charArray, 1); + }, 25) +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..1845ae7 --- /dev/null +++ b/index.html @@ -0,0 +1,38 @@ + + + Billboard + + + + + + + +

 

+ + + + + + + + diff --git a/linearx-20171201-180714-516307-740daec-24931da.ttf b/linearx-20171201-180714-516307-740daec-24931da.ttf new file mode 100644 index 0000000..f3fe968 Binary files /dev/null and b/linearx-20171201-180714-516307-740daec-24931da.ttf differ