forked from escapevelocity1/TheButton
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbutton.html
More file actions
181 lines (170 loc) · 5.08 KB
/
button.html
File metadata and controls
181 lines (170 loc) · 5.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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html>
<body bgcolor=#444444></body>
<style>
body {
overflow: hidden; /*hide scrollbar*/
}
.button {
border-style: dash; /*decorate button*/
border-width: 5px;
border-radius: 20px;
border-color: #aaaaaa;
padding: 50px 50px;
max-width: 50px;
max-height: 50px;
display: inline-block;
margin: 30px 10px;
cursor: pointer;
position: relative;
z-index: 5;
}
.itembutton {
border-style: dash;
border-width: 3px;
border-radius: 2px;
border-color: #aaaacc;
padding: 10px 10px;
position: relative; top: 280px; right: 120px;
background-color: #444444;
cursor: crosshair;
}
@keyframes pulse {
0% {
background-color: #aa2222; /* animate main button */
}
50% {
background-color: #cc2222;
}
100% {
background-color: #aa2222;
}
}
.button {
animation: pulse 1s infinite;
}
@keyframes pulse2 {
0% {
color: white;
}
50% {
color: #ffff88;
}
100% {
color: white;
}
}
@keyframes poverty {
0% {
background-color: #444444;
}
50% {
background-color: #cc2222;
}
100% {
background-color: #444444;
}
}
.top {
border-bottom: 5px solid #656575; /*top gray bar*/
background-color: gray;
height: 150px;
width: 105%;
margin: -60px -8px -10px -8px;
}
.store {
border-top: 5px solid #656575; /*bottom blue bar, to contain the store*/
background-color: #545464;
height: 150px;
width: 105%;
margin: 155px -8px -10px -8px;
}
.decor {
border-top: 5px solid #4545; /*middle decorative gray bar*/
border-bottom: 5px solid #4545;
background-color: #343434;
height: 150px;
width: 105%;
position: relative; bottom: 385px; right: 19px;
z-index: 1;
}
</style>
<body>
<p1 id="counter"
style="margin:15px;color:white;font-family:calibri;font-size:40px;background-color:#222222;
border-style:solid;border-width:2px;border-color:#656575";>0</p1>
<p2 id="gainCounter"
style="margin:15px;color:white;font-family:calibri;font-size:20px;background-color:#222222;
border-style:solid;border-width:2px;border-color:#656575;position:relative;top:32px;right:153px;
animation:pulse2 2s infinite;">1x</p2>
<div class="top"></div>
<button class="button" id="b1"></button>
<!--Make item buttons be hidden by default when that point is reached-->
<button class="itembutton" id="b2" style="font-family:calibri;animation:pulse2 2s infinite;position:relative;right:120px">x2</button>
<button class="itembutton" id="b3" style="font-family:calibri;color:#9999ff;position:relative;top:330px;right:163px">1/s</button>
<p3 id="message"
style="font-family: Verdana;font-size:20px;color:white;position:relative;bottom:15px"></p3>
<div class="store"></div>
<div class="decor"></div>
<p4 id="storeText" style="font-family: Verdana;color:white;position:relative;bottom:280px;left:60px;display:none">Click Multiplier</p4>
<script>
// basic variables
var clicks = 0;
var clickGain = 1; //"clicks gained per click", changing affects multiplier
var Progression = 0;
// variables for typewriter animation
var i = 0;
var txt = "It appears you don't have anything better to do.";
var speed = 20;
// variables for items
var cost1 = 8;
document.getElementById("b1").onclick = clickA;
document.getElementById("b2").onclick = clickB; // click upgrade
// the main click function
function clickA(){
clicks += clickGain;
document.getElementById("counter").innerHTML =clicks + " clicks"
if (clicks >= 15) {typeAnimation()}
}
// click multiplier upgrade
function clickB(){
if (clicks >= cost1) {
clickGain++
clicks -= cost1
cost1 *= 2
document.getElementById("storeText").innerHTML ="Click Multiplier - cost: " + cost1
} else if (clicks >= 0) {
document.getElementById("b2").style.animation = "pulse2 2s infinite, poverty 2s 1"
setTimeout(function Reanimate(){document.getElementById("b2").style.animation = "pulse2 2s infinite"}, 2000)
} else {clicks += (cost1 / 2)
document.getElementById("b2").style.animation = "pulse2 2s infinite, poverty 2s 1"
setTimeout(function Reanimate(){document.getElementById("b2").style.animation = "pulse2 2s infinite"}, 2000)
}
}
// the update function, to update counters every 10 milliseconds
function update(){
document.getElementById("gainCounter").innerHTML =clickGain + "x"
document.getElementById("counter").innerHTML =clicks + " clicks"
}
setInterval(update, 10)
// text with animation
function typeAnimation(){
if (i < txt.length) {
document.getElementById("message").innerHTML += txt.charAt(i);
i++;
setTimeout(typeAnimation, speed);
}
if (clicks == 25) {document.getElementById("message").innerHTML=" "
txt="The Shop has been opened."
i=0
document.getElementById("b2").style.display = "inline-block"
document.getElementById("storeText").style.display = "inline-block"
document.getElementById("gainCounter").style.display = "inline-block"
}
if (clicks >= 85) {
document.getElementById("b3").style.display = "inline-block";
}
}
</script>
</body>
</html>