-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule.html
146 lines (125 loc) · 3.76 KB
/
module.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Permanent+Marker&display=swap" rel="stylesheet">
<style>
html, body {
height: 100%;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
background: radial-gradient(circle, #8B0000, #400000);
color: gold;
font-family: 'Playfair Display', serif;
text-align: center;
overflow: hidden;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
}
.title {
font-size: 2em;
font-weight: bold;
text-shadow: 2px 2px 8px rgba(255, 215, 0, 0.8);
}
.red-button {
width: 70px;
height: 70px;
background: radial-gradient(circle, red, darkred);
border: 3px solid gold;
border-radius: 50%;
box-shadow: 0px 6px 12px rgba(255, 0, 0, 0.7), inset 0px 3px 6px rgba(255, 255, 255, 0.5);
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
}
.red-button:hover {
transform: scale(1.1);
box-shadow: 0px 8px 16px rgba(255, 0, 0, 1), inset 0px 4px 8px rgba(255, 255, 255, 0.7);
}
.red-button:active {
transform: scale(0.95);
box-shadow: 0px 3px 8px rgba(255, 0, 0, 0.5);
}
/* Animation effects */
.strike-effect {
animation: flash-red 0.6s, shake 0.4s;
}
.solve-effect {
animation: glow-green 0.6s;
}
@keyframes flash-red {
0% { background: red; }
50% { background: darkred; }
100% { background: red; }
}
@keyframes shake {
0%, 100% { transform: translateX(0); }
25% { transform: translateX(-5px); }
50% { transform: translateX(5px); }
75% { transform: translateX(-5px); }
}
@keyframes glow-green {
0% { box-shadow: 0px 6px 12px rgba(255, 0, 0, 0.7); }
50% { box-shadow: 0px 6px 20px rgba(0, 255, 0, 0.9); }
100% { box-shadow: 0px 6px 12px rgba(255, 0, 0, 0.7); }
}
.message {
font-size: 1em;
opacity: 0;
transition: opacity 0.5s;
}
.message.show {
opacity: 1;
}
</style>
</head>
<body>
<div class="container">
<div class="title">
<span>Try Your Luck!</span>
</div>
<button id="chance" class="red-button"></button>
<div id="message" class="message"></div>
</div>
</body>
<script type="module">
import BombModule from "https://hannes-dev.github.io/YUBOG/ModuleLib.js";
const bombModule = new BombModule();
const button = document.getElementById("chance");
const message = document.getElementById("message");
document.getElementById("chance").addEventListener("click", press);
function press() {
const number = Math.random();
if (number < 0.3) {
bombModule.sendStrike();
triggerStrikeEffect();
return;
}
bombModule.sendSolve();
triggerSolveEffect();
}
function triggerStrikeEffect() {
button.classList.add("strike-effect");
message.textContent = "💥 Boom! You lost!";
message.classList.add("show");
setTimeout(() => {
button.classList.remove("strike-effect");
message.classList.remove("show");
}, 1000);
}
function triggerSolveEffect() {
button.classList.add("solve-effect");
message.textContent = "🎉 You won!";
message.classList.add("show");
setTimeout(() => {
button.classList.remove("solve-effect");
message.classList.remove("show");
}, 1000);
}
</script>
</html>