-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
45 lines (34 loc) · 1.07 KB
/
scripts.js
File metadata and controls
45 lines (34 loc) · 1.07 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const container = document.getElementById('container');
const text = document.getElementById('text');
const totalTime = 11500;
const breathTimeIn = 3000;
const holdTime = 3500;
const breathTimeOut = 5000;
breathAnimation();
function breathAnimation() {
text.innerText = 'ដង្ហើមចូល';
container.className = 'container grow';
setTimeout(()=>{
text.innerText = 'ទប់ដង្ហើម';
setTimeout(()=> {
text.innerText = 'ដង្ហើមចេញ';
container.className = 'container shrink';
setTimeout(()=>{
}, breathTimeOut)
}, holdTime);
}, breathTimeIn);
}
setInterval(breathAnimation, totalTime);
document.addEventListener("click", play);
var audio = document.getElementById("audio");
var isPlaying = false;
function play() {
audio.volume = 0.2;
isPlaying ? audio.pause() : audio.play();
};
audio.onplaying = function() {
isPlaying = true;
};
audio.onpause = function() {
isPlaying = false;
};