Skip to content

Instantly share code, notes, and snippets.

@chankruze
Created September 5, 2018 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chankruze/41b156a9acbe6a28ee01301412afdf68 to your computer and use it in GitHub Desktop.
Save chankruze/41b156a9acbe6a28ee01301412afdf68 to your computer and use it in GitHub Desktop.
Monitor Screen Lines/Pixels Effect
<p>initializing</p>

Monitor Screen Lines/Pixels Effect

This pen shows how pure CSS can be used to create a retro monitor screen lines/pixels effect.

A Pen by George W. Park on CodePen.

License.

window.addEventListener("DOMContentLoaded", () => {
const textOutput = document.querySelector('p'),
phrases = ['checking systems', 'deleting hard drive', 'whoops'],
delay = [2000, 4000, 6000];
phrases.forEach((phrase, i) => setTimeout(() => textOutput.textContent = phrase, delay[i]));
});
* {
box-sizing: border-box;
}
:root {
font-size: 10px;
/* Blue Theme */
--text-color: #eee;
--bg-color-start: #00d;
--bg-color-end: #003;
/* Black Theme */
/* --text-color: #eee;
--bg-color-start: #1a1a1a;
--bg-color-end: #080808; */
/* Green Theme */
/* --text-color: #1fff66;
--bg-color-start: #020;
--bg-color-end: #000a00; */
}
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
overflow: hidden;
background: radial-gradient(var(--bg-color-start), var(--bg-color-end));
}
body::after {
content: '';
position: absolute;
width: 100%;
height: 100%;
background-image: repeating-linear-gradient(transparent, rgba(0, 0, 0, 0.3) 0.5em);
}
p {
position: relative;
font-family: 'VT323', monospace;
font-size: calc(2em + 5vw);
color: var(--text-color);
text-shadow: 0 0 0.025em var(--text-color);
text-align: center;
text-transform: uppercase;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
p::after {
content: '';
position: absolute;
animation: dots 1s linear infinite;
}
@keyframes dots {
25% {
content: '.';
}
50% {
content: '..';
}
75% {
content: '...';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment