Skip to content

Instantly share code, notes, and snippets.

@michal-niedzwiedzki
Created August 7, 2020 09:42
Show Gist options
  • Save michal-niedzwiedzki/5a6c77830fad5c70168fac4e7f479449 to your computer and use it in GitHub Desktop.
Save michal-niedzwiedzki/5a6c77830fad5c70168fac4e7f479449 to your computer and use it in GitHub Desktop.
<html>
<head>
<style style="text/css">
body {
background-color: #202020;
color: red;
font-family: "Atari Classic Chunky", sans-serif;
}
.hakierowanie { width: 600px; }
</style>
</head>
<body>
<h1>Tu som hakiery, dej pozur</h1>
<div class="hakierowanie">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<script type="text/javascript">
const container = document.querySelector(".hakierowanie");
var content = container.innerHTML;
const writeSomething = function (character, index) {
setTimeout(function () {
container.innerHTML += character;
}, 50 * index + Math.random() * 30);
};
container.innerHTML = "";
for (var i = 0; i < content.length; ++i) {
writeSomething(content[i], i);
}
const damages = [
function () { document.body.style.marginLeft = (Math.random() * 20) + "px"; },
function () { document.body.style.color = "rgba(" + (125 + Math.floor(Math.random() * 120)) + ", 0, 0)"; },
function () { document.body.style.transform = "rotate(" + (Math.floor(Math.random() * 5) - 2) + "deg)"; }
];
const runDamages = function () {
for (var i = 0; i < damages.length; i++) {
damages[i]();
}
setTimeout(runDamages, 50 + Math.random() * 100);
}
runDamages();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment