Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Load Animations/Text async animation/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text async animation</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>

<h1 id="animatethis">Loading!</h1>

</body>
</html>
46 changes: 46 additions & 0 deletions Load Animations/Text async animation/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
function swoop(text, infinite) {
let TextToAnimate = document.getElementById(text)
let TTAString = TextToAnimate.innerHTML
TextToAnimate.innerHTML = ''

for (var x = 0; x < TTAString.length; x++) {
if (TTAString[x] === ' ') {
TextToAnimate.innerHTML += '<span>' + '&nbsp;' + '</span>'
} else {
TextToAnimate.innerHTML += '<span>' + TTAString[x] + '</span>'
}
}
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
async function elanimate(text) {
text = text.getElementsByTagName('span')
for (i = 0; i < text.length; i++) {
text[i].classList.add('animate')
await sleep(100)
}
await sleep(300)
for (i = 0; i < text.length; i++) {
text[i].classList.add('animate2')
await sleep(100)
}
await sleep(300)
for (i = 0; i < text.length; i++) {
text[i].classList.add('animate3')
await sleep(100)
}
if (infinite === true) {
await sleep(1000)
for (i = 0; i < text.length; i++) {
text[i].classList.remove('animate')
text[i].classList.remove('animate2')
text[i].classList.remove('animate3')
}
} else {
return
}
elanimate(TextToAnimate, infinite)
}
elanimate(TextToAnimate, infinite)
}
swoop('animatethis', true) // id of text to animate, true = infinite
61 changes: 61 additions & 0 deletions Load Animations/Text async animation/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
@import url("https://fonts.googleapis.com/css2?family=Comfortaa&display=swap");
body {
background: #0a043c;
color: #ffe3d8;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin:0;
padding:0;
}
h1 {
font-variant: Small-caps;
font-size: 6em;
letter-spacing:0.2em;
}

span {
opacity: 0;
display: inline-block;
transform: scale(0.8);
}
span.animate {
animation: pog 460ms cubic-bezier(0.785, 0.135, 0.15, 0.86) forwards;
}
span.animate2 {
animation: pog2 460ms cubic-bezier(0.785, 0.135, 0.15, 0.86) forwards;
}
span.animate3 {
animation: pog3 460ms cubic-bezier(0.785, 0.135, 0.15, 0.86) forwards;
}
@keyframes pog {
from {
opacity: 0;
transform: scale(0.8) rotate(15deg);
}
to {
opacity: 1;
transform: scale(1);
}
}
@keyframes pog2 {
from {
opacity: 1;
transform: translateX(0px);
}
to {
opacity: 0;
transform: scale(0.8) translateX(-10px) rotate(10deg);
}
}
@keyframes pog3 {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0px);
}
}