diff --git a/randomThemer.js b/randomThemer.js index 73adf39..bd70d6c 100644 --- a/randomThemer.js +++ b/randomThemer.js @@ -109,14 +109,18 @@ function purpleMagic() { return html } +function code() { + return ' ' +} + var events = [ rain(), purpleMagic(), + code(), "", ] module.exports = { - returnTheme: function() { var time = new Date() return events[time.getDate() % events.length] diff --git a/static/themes/code/script.js b/static/themes/code/script.js new file mode 100644 index 0000000..af74e28 --- /dev/null +++ b/static/themes/code/script.js @@ -0,0 +1,27 @@ +function typeWriter(elem, delay) { + var elemText = elem.text().split('') + elem.text('_'.repeat(elemText.length)) + var i = 0 + function nextLetter() { + console.log(elemText.length - i) + elem.text(elemText.slice(0, i).join('') + '_'.repeat(elemText.length - i)) + if (i < elemText.length) { + setTimeout(() => { + i++ + nextLetter() + }, 20) + } + } + setTimeout(nextLetter, delay); +} + +$(document).ready(() => { + var i = 0 + var arr = $("span").each((_, item) => { + if ($(item).text().length > 0) { + i++ + typeWriter($(item), i * 450) + } + // $(item).text("APPL") + }) +}) \ No newline at end of file diff --git a/static/themes/code/style.css b/static/themes/code/style.css new file mode 100644 index 0000000..4d2c865 --- /dev/null +++ b/static/themes/code/style.css @@ -0,0 +1,16 @@ +* { + font-family: "Consolas", "Monaco", "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New"; +} + +body { + background: black; +} + +.mainTitle { + color: limegreen !important; +} + +.mainTitle { + animation: typer 2s linear; + margin: auto; +} \ No newline at end of file