数字記憶10個 🕵️♂️🔢🎲
🌟✨🔮🎉🧩🔢🎯🚀🌈💫
経過時間: 0.0秒 ⏱️
```html
<!DOCTYPE html>
<html>
<head>
<title>数字記憶10個 🎉🧠✨</title>
<style>
@keyframes bounce {
0% { transform: scale(1); }
50% { transform: scale(1.2); }
100% { transform: scale(1); }
}
@keyframes fadeOut {
from { opacity: 1; }
to { opacity: 0; }
}
@keyframes sparkle {
0%, 100% { text-shadow: 0 0 5px gold, 0 0 10px gold; }
50% { text-shadow: 0 0 20px gold, 0 0 30px gold; }
}
.bounce {
animation: bounce 0.5s;
}
.fadeOut {
animation: fadeOut 1s forwards;
}
.sparkle {
animation: sparkle 1s infinite;
}
</style>
</head>
<body>
<div style="width: 400px; height: 400px; margin: 0 auto; text-align: center; position: relative; font-family: Arial, sans-serif;">
<h1 class="sparkle" style="font-size: 24px; margin-top: 20px;">数字記憶10個 🕵️♂️🔢🎲</h1>
<div id="numbers" style="font-size: 32px; margin: 20px 0; height: 50px; display: none;">
🌟✨🔮🎉🧩🔢🎯🚀🌈💫
</div>
<input type="button" id="startBtn" value="開始 🏁" style="padding: 10px 20px; font-size: 18px; cursor: pointer;" onclick="startGame()">
<input type="button" id="endBtn" value="終了 🛑" style="padding: 10px 20px; font-size: 18px; cursor: pointer; display: none; margin-top: 10px;" onclick="endGame()">
<div id="time" style="font-size: 20px; margin-top: 20px; display: none;">経過時間: 0.0秒 ⏱️</div>
<input type="button" id="answerBtn" value="回答 📝" style="padding: 10px 20px; font-size: 18px; cursor: pointer; display: none; margin-top: 10px;" onclick="showAnswer()">
<input type="button" id="retryBtn" value="もう一度 🔄" style="padding: 10px 20px; font-size: 18px; cursor: pointer; display: none; margin-top: 10px;" onclick="retryGame()">
<div id="emojiReaction" style="position: absolute; top: 180px; left: 50%; transform: translateX(-50%); font-size: 48px;"></div>
</div>
<script>
let startTime, endTime;
let numbersArray = [];
function getRandomNumbers() {
let nums = [];
for(let i=0;i<10;i++) {
nums.push(Math.floor(Math.random() * 10));
}
return nums;
}
function displayNumbers(nums) {
const numbersDiv = document.getElementById('numbers');
numbersDiv.innerHTML = '';
nums.forEach(num => {
numbersDiv.innerHTML += `<span>🔢 ${num} 🔢</span> `;
});
numbersDiv.style.display = 'block';
}
function startGame() {
document.getElementById('startBtn').classList.add('bounce');
setTimeout(() => { document.getElementById('startBtn').classList.remove('bounce'); }, 500);
numbersArray = getRandomNumbers();
displayNumbers(numbersArray);
startTime = new Date();
document.getElementById('endBtn').style.display = 'inline-block';
}
function endGame() {
document.getElementById('endBtn').classList.add('bounce');
setTimeout(() => { document.getElementById('endBtn').classList.remove('bounce'); }, 500);
endTime = new Date();
let elapsed = ((endTime - startTime) / 1000).toFixed(1);
document.getElementById('time').innerHTML = `経過時間: ${elapsed} 秒 ⏱️`;
document.getElementById('time').style.display = 'block';
document.getElementById('numbers').classList.add('fadeOut');
setTimeout(() => { document.getElementById('numbers').style.display = 'none'; }, 1000);
document.getElementById('endBtn').style.display = 'none';
document.getElementById('answerBtn').style.display = 'inline-block';
showEmojiReaction();
}
function showAnswer() {
document.getElementById('answerBtn').classList.add('bounce');
setTimeout(() => { document.getElementById('answerBtn').classList.remove('bounce'); }, 500);
displayNumbers(numbersArray);
document.getElementById('answerBtn').style.display = 'none';
document.getElementById('retryBtn').style.display = 'inline-block';
showEmojiReaction();
}
function retryGame() {
document.getElementById('retryBtn').classList.add('bounce');
setTimeout(() => { document.getElementById('retryBtn').classList.remove('bounce'); }, 500);
document.getElementById('time').style.display = 'none';
document.getElementById('numbers').style.display = 'none';
document.getElementById('retryBtn').style.display = 'none';
document.getElementById('startBtn').style.display = 'inline-block';
showEmojiReaction();
}
function showEmojiReaction() {
const reactions = ['🎉', '✨', '🚀', '🌈', '🔥', '💥', '🎊', '🥳', '🕺', '💃'];
const emoji = reactions[Math.floor(Math.random() * reactions.length)];
const reactionDiv = document.getElementById('emojiReaction');
reactionDiv.innerHTML = emoji;
reactionDiv.classList.add('bounce');
setTimeout(() => {
reactionDiv.classList.remove('bounce');
reactionDiv.innerHTML = '';
}, 500);
}
</script>
</body>
</html>
```