-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html lang="ko"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>로또 추천기</title> | ||
<link rel="stylesheet" href="styles.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>로또 추천기</h1> | ||
<div id="roulette" class="roulette"></div> | ||
<div id="numbers"></div> | ||
<button id="generate-btn">번호 추천 받기</button> | ||
</div> | ||
|
||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
function generateLottoNumbers() { | ||
let numbers = []; | ||
while (numbers.length < 6) { | ||
let randomNumber = Math.floor(Math.random() * 45) + 1; | ||
if (!numbers.includes(randomNumber)) { | ||
numbers.push(randomNumber); | ||
} | ||
} | ||
return numbers; | ||
} | ||
|
||
|
||
function createRouletteBalls() { | ||
let roulette = document.getElementById('roulette'); | ||
roulette.innerHTML = ''; | ||
for (let i = 1; i <= 45; i++) { | ||
let ball = document.createElement('div'); | ||
ball.className = 'ball'; | ||
ball.textContent = i; | ||
roulette.appendChild(ball); | ||
} | ||
} | ||
|
||
function animateRoulette() { | ||
let balls = document.querySelectorAll('.ball'); | ||
let interval = setInterval(() => { | ||
balls.forEach(ball => { | ||
ball.style.order = Math.floor(Math.random() * 45); | ||
}); | ||
}, 100); | ||
|
||
setTimeout(() => { | ||
clearInterval(interval); | ||
let numbers = generateLottoNumbers(); | ||
let numbersDiv = document.getElementById('numbers'); | ||
numbersDiv.textContent = '추천 번호: ' + numbers.join(', '); | ||
balls.forEach(ball => { | ||
if (numbers.includes(parseInt(ball.textContent))) { | ||
ball.style.backgroundColor = '#ff0000'; | ||
} else { | ||
ball.style.backgroundColor = '#007bff'; | ||
} | ||
}); | ||
}, 5000); // Adjust the duration of the roulette animation here | ||
} | ||
|
||
document.getElementById('generate-btn').addEventListener('click', () => { | ||
createRouletteBalls(); | ||
animateRoulette(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
background-color: #f0f0f0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
margin: 0; | ||
} | ||
|
||
.container { | ||
text-align: center; | ||
background-color: #fff; | ||
padding: 20px; | ||
border-radius: 8px; | ||
box-shadow: 0 0 10px rgba(0,0,0,0.1); | ||
max-width: 400px; | ||
width: 90%; | ||
} | ||
|
||
h1 { | ||
color: #333; | ||
} | ||
|
||
#roulette { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
margin: 20px 0; | ||
} | ||
|
||
.ball { | ||
width: 30px; | ||
height: 30px; | ||
border-radius: 50%; | ||
background-color: #007bff; | ||
color: #fff; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
margin: 5px; | ||
font-size: 16px; | ||
} | ||
|
||
#numbers { | ||
margin: 20px 0; | ||
font-size: 24px; | ||
} | ||
|
||
button { | ||
background-color: #007bff; | ||
color: #fff; | ||
border: none; | ||
padding: 10px 20px; | ||
font-size: 18px; | ||
cursor: pointer; | ||
border-radius: 4px; | ||
transition: background-color 0.3s ease; | ||
} | ||
|
||
button:hover { | ||
background-color: #0056b3; | ||
} |