A Pen by Yu Chun Man Jason on CodePen.
Created
June 18, 2017 20:32
-
-
Save ycmjason/432fc60721a7e50c8f9ccc365a66f9ec to your computer and use it in GitHub Desktop.
Code with Jason
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="centered"> | |
<div id="logo" class="prefix-rotating"></div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SPIN_DURATION = (n) => n*500; | |
const TYPING_DURATION = 2000; | |
const DELAY_BEFORE_TYPING = SPIN_DURATION(2); | |
const DELAY_BEFORE_STOP_SPINNING = TYPING_DURATION + DELAY_BEFORE_TYPING + SPIN_DURATION(2); | |
const logo = document.getElementById('logo'); | |
const logo_text = '> Code with Jason'; | |
const logo_fill_arr = logo_text.split('').reverse(); | |
setTimeout(() => { | |
var id = setInterval(() => { | |
if(logo_fill_arr.length === 0) return clearInterval(id) | |
logo.innerHTML += logo_fill_arr.pop(); | |
}, TYPING_DURATION/logo_fill_arr.length) | |
}, DELAY_BEFORE_TYPING); | |
setTimeout(() => { | |
logo.classList.add('prefix') | |
logo.classList.remove('prefix-rotating') | |
}, DELAY_BEFORE_STOP_SPINNING); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$font-stack: "ubuntu"; | |
$background-color: #002b36; | |
$font-color: #657b83; | |
@keyframes rotate { | |
from {transform: rotate(0deg)} | |
to {transform: rotate(360deg)} | |
} | |
.rotating{ | |
animation: rotate 0.5s infinite; | |
} | |
body, html{ | |
font-family: $font-stack; | |
background: $background-color; | |
color: $font-color; | |
height: 100%; | |
} | |
.centered{ | |
height: 100%; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
font-size: 80px; | |
} | |
#logo{ | |
} | |
.prefix::before{ | |
content: '/'; | |
display: inline-block; | |
} | |
.prefix-rotating::before{ | |
@extend .prefix; | |
@extend .rotating; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="//fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment