html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gacha Game</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>Gacha Spin Game</h1>
<div class="ball" id="ball">🔮</div>
<button id="spinButton">Spin</button>
<div id="result" class="result"></div>
</div>
<script src="script.js"></script>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
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
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: linear-gradient(135deg, black, black);
font-family: 'Arial', sans-serif;
margin: 0;
}
.container {
text-align: center;
background-color: grey;
border-radius: 15px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
padding: 30px;
width: 300px;
}
h1 {
font-size: 24px;
margin-bottom: 20px;
color: #333;
}
.ball {
font-size: 100px;
Enter to Rename, Shift+Enter to Preview
js
js
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
document.addEventListener('DOMContentLoaded', () => {
const spinButton = document.getElementById('spinButton');
const ball = document.getElementById('ball');
const resultDiv = document.getElementById('result');
const results = [
"you got a skill ",
"you got a new friend",
"you got a girl friend",
"you got a boy friend",
"you got a new setup",
"you got a new business"
];
spinButton.addEventListener('click', () => {
// Add shake class to ball
ball.classList.add('shake');
// Remove shake class after animation ends
setTimeout(() => {
ball.classList.remove('shake');
// Randomly select a result
const randomIndex = Math.floor(Math.random() * results.length);
const result = results[randomIndex];
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Запуск