forked from harshsingla/tankwarweb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmai.js
More file actions
108 lines (91 loc) · 2.31 KB
/
mai.js
File metadata and controls
108 lines (91 loc) · 2.31 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
function NavMenu() {
nav = document.getElementById("header");
//alert(window.pageYOffset);
if (window.pageYOffset >= 700) {
nav.style.top = "0px";
}
else {
nav.style.top = "-50px";
}
}
window.onload=Init;
function myMove() {
navcheck = setInterval(NavMenu, 1000);
var elem = document.getElementById("balloftank");
var pos = 0;
var id = setInterval(frame, 10);
console.log(elem.id);
function frame()
{
if (pos ==97)
{
document.getElementById('balloftank').style.display='none';
document.getElementById('spanidofgame').style.visibility='visible';
clearInterval(id);
}
else
{pos++;
elem.style.left = pos + "px";
}
}
}
//mayank part
x = 0; //refer to objects
addi = 45;
function Init() {
img = [new SI(90, "SI_img1"), new SI(45, "SI_img2"), new SI(0, "SI_img3"), new SI(-45, "SI_img4"), new SI(-90, "SI_img5")];
}
auto = setInterval(Slider, 5000, 1);
function Slider(a){
addi = a * addi;
//img[x].move();
tim = setInterval(tr, 10);
}
function tr() {
if (x < 5) {
img[x].move();
x++;
}
else {
x = 0;
addi = 45;
clearInterval(tim);
}
}
class SI {
constructor(current, name){
this.current = current;
this.i = document.getElementById(name);
}
move() {
//alert("abbb");
this.i.style.transform = "translateX("+(-20*(this.current + addi))+"px) rotateY("+(this.current + addi)+"deg)";
//this.i.style.transform = "rotateY("+(this.current + addi)+"deg)";
this.current = this.current + addi;
//this.i.style.zIndex = "-1";
if (this.current == 0) {this.i.style.zIndex = "1";}
else {this.i.style.zIndex = "-1";}
this.check();
}
check() {
if (this.current > 90) {
this.i.style.transition = "0.1s";
this.i.style.visibility = "hidden";
this.i.style.transform = "translateX(900px) rotateY(-90deg)";
this.current = -90;
this.i.style.zIndex = "-2";
this.i.style.visibility = "visible";
this.i.style.transition = "1s";
}
if (this.current < -90) {
this.i.style.transition = "0.1s";
this.i.style.visibility = "hidden";
this.i.style.transform = "translateX(-900px) rotateY(90deg)";
this.current = 90;
this.i.style.zIndex = "-2";
this.i.style.visibility = "visible";
this.i.style.transition = "1s";
}
}
}
//ends here