forked from AyanSaha25/hacktoberfest-2020
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
26 lines (20 loc) · 661 Bytes
/
app.js
File metadata and controls
26 lines (20 loc) · 661 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const container = document.getElementById("container");
const text = document.getElementById("text");
// 7500 is equal to 7.5sec
const totalTime = 7500;
const breatheTime = (totalTime / 5) * 2;
const holdTime = totalTime / 5;
breatheAnimation();
function breatheAnimation() {
text.innerText = "breathe in!";
container.className = "container grow";
setTimeout(() => {
text.innerText = "hold";
setTimeout(() => {
text.innerText = "breathe out";
container.className = "container shrink";
}, holdTime);
}, breatheTime);
}
//to run this animation every 7.5sec
setInterval(breatheAnimation, totalTime);