-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
40 lines (35 loc) · 1.08 KB
/
Copy pathscript.js
File metadata and controls
40 lines (35 loc) · 1.08 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
class MovingText
{
constructor(doctorText, animation, animationTime, timeout)
{
this.doctorText = doctorText;
this.animation = animation;
this.animationTime = animationTime;
this.timeout = timeout;
this.index = 0;
}
show()
{
this.doctorText[this.index].style.display = "block";
this.doctorText[this.index].style.animation = this.animation + " " + this.animationTime + " ease";
this.time();
}
time()
{
setInterval(()=>{
this.doctorText[this.index].style.display = "none";
this.doctorText[this.index].style.animation = "";
if (this.index < (this.doctorText.length - 1)){
this.index += 1;
} else {
this.index = 0;
}
this.doctorText[this.index].style.display = "block";
this.doctorText[this.index].style.animation = this.animation + " " + this.animationTime + " ease";
}, this.timeout);
}
init()
{
this.show();
}
}