-
Notifications
You must be signed in to change notification settings - Fork 3
/
coin_flip.html
268 lines (215 loc) · 7.51 KB
/
coin_flip.html
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>How To Generate QR Code Using Javascript</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<script
src="https://cdn.jsdelivr.net/gh/gitbrent/[email protected]/dist/bootstrap-switch-button.min.js"></script>
<script>
src="https://cdn.jsdelivr.net/gh/gitbrent/[email protected]/dist/bootstrap-switch-button.min.js"></script>
</head>
<section>
<div id="box">
<div id="coin">
<div class="side-a"></div>
<div class="side-b"></div>
</div>
<h1>Click on coin to flip</h1>
<div class="wrap">
<div class="btn-text-left">
<center><button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-new">
More info
</center>
</button>
</div>
</div>
<div class="modal fade bs-example-modal-new" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog">
<!-- Modal Content: begins -->
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<center><h4 class="modal-title" id="gridSystemModalLabel">FAQ</h4></center>
</div>
<!-- Modal Body -->
<div class="modal-body">
<div class="body-message">
<p> ➡No coins in your pocket? With our online coin flipper tool you can instantly flip coin.
<br><BR>
➡Touch on the coin to flip
<br><br>
➡A Coin Flip in an online simulator for doing a coin toss, when you don't have any real coins. Both people should choose heads or tails before flipping the virtual coins. The tool will then flip a coin using a random method and decide the winner of the coin flip.
<br><BR>
➡A coin flip is already used for ages to make a random decision. Flipping a coin is widely used in sports and games or just a fun way to decide who is going to start or has to do a task. The only thing which make our tool different than a real coin flip, is that our coin can't flip on the edge.
<br> <br>
➡The probability of heads or tails is also 50:50 as if you toss a coin hardly or softly in the real world.
<br> <br>
➡The coin flip generator is truly random and can't be manipulated.
</p>
</div>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
</div>
</div>
<!-- Modal Content: ends -->
</div>
</div>
</div>
<!-- Trigger the modal with a button -->
</section>
<script>
jQuery(document).ready(function($){
$('#coin').on('click', function(){
var flipResult = Math.random();
$('#coin').removeClass();
setTimeout(function(){
if(flipResult <= 0.5){
$('#coin').addClass('heads');
console.log('it is head');
value1.push("head");
}
else{
$('#coin').addClass('tails');
console.log('it is tails');
value2.push("Tails");
}
}, 100);
});
});
</script>
<script>
function myFunction() {
for (var i=0; i<value1.length; i++)
console.log(i + ". " + value1[i]);
}
</script>
<style>
.btn-text-left{
text-align: left;
}
p {
text-align: left;
font-size: 15px;
background-color: rgb(227, 238, 197);
}
body {
padding-top: 50px;
-webkit-perspective: 800px;
width: 100%;
height: 100%;
background:linear-gradient(to right top ,#b597f6,#439cfb);
display: flex;
justify-content: center;
align-items: center;
}
h1{
text-align: center;
}
.bottomright {
position: absolute;
bottom: 8px;
right: 16px;
font-size: 18px;
}
#coin {
position: relative;
margin: 0 auto;
width: 500px;
height: 500px;
cursor: pointer;
}
#coin div {
width: 100%;
height: 100%;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
-webkit-box-shadow: inset 0 0 45px rgba(255,255,255,.3), 0 12px 20px -10px rgba(0,0,0,.4);
-moz-box-shadow: inset 0 0 45px rgba(255,255,255,.3), 0 12px 20px -10px rgba(0,0,0,.4);
box-shadow: inset 0 0 45px rgba(255,255,255,.3), 0 12px 20px -10px rgba(0,0,0,.4);
}
.side-a {
background-image: url();
display: block;
width: 40px;
height: 40px;
background: #E6E7ED;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
background-image: url(https://media.istockphoto.com/vectors/money-vector-id1270779408?k=20&m=1270779408&s=612x612&w=0&h=NeirkHfD6PCHejwyssXKxXst6kBvaP4fhUu7NGz2xro=);
background-position:50% 50%;
background-repeat:no-repeat;
}
.side-a>image {
max-height: 50%;
max-width: 100%;
}
.side-b {
background-image: url();
display: block;
width: 40px;
height: 40px;
background: #E6E7ED;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
background-image: url('https://thumbs.dreamstime.com/b/india-one-rupee-coin-white-isolated-background-india-one-rupee-coin-white-isolated-background-212931097.jpg');
background-position:50% 50%;
background-repeat:no-repeat;
}
.box{
width: 60%;
height: 90%;
padding: 50px 15px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
background: #fff;
box-shadow: 0 10px 25px -10px rgba(0,0,0,0.5);
border-radius: 5px;
/*padding-top: 30px;
padding: 30px;*/
}
#coin {
transition: -webkit-transform 1s ease-in;
-webkit-transform-style: preserve-3d;
}
#coin div {
position: absolute;
-webkit-backface-visibility: hidden;
}
.side-a {
z-index: 100;
}
.side-b {
-webkit-transform: rotateY(-180deg);
}
#coin.heads {
-webkit-animation: flipHeads 3s ease-out forwards;
-moz-animation: flipHeads 3s ease-out forwards;
-o-animation: flipHeads 3s ease-out forwards;
animation: flipHeads 3s ease-out forwards;
}
#coin.tails {
-webkit-animation: flipTails 3s ease-out forwards;
-moz-animation: flipTails 3s ease-out forwards;
-o-animation: flipTails 3s ease-out forwards;
animation: flipTails 3s ease-out forwards;
}
@-webkit-keyframes flipHeads {
from { -webkit-transform: rotateY(0); -moz-transform: rotateY(0); transform: rotateY(0); }
to { -webkit-transform: rotateY(1800deg); -moz-transform: rotateY(1800deg); transform: rotateY(1800deg); }
}
@-webkit-keyframes flipTails {
from { -webkit-transform: rotateY(0); -moz-transform: rotateY(0); transform: rotateY(0); }
to { -webkit-transform: rotateY(1980deg); -moz-transform: rotateY(1980deg); transform: rotateY(1980deg); }
}
</style>