mirror of
https://github.com/acedanger/docker.git
synced 2025-12-06 01:10:11 -08:00
472 lines
15 KiB
HTML
472 lines
15 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Toddler Math Flash Cards - Skip Counting by 2s!</title>
|
|
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap" rel="stylesheet">
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Nunito', sans-serif;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: flex-start;
|
|
color: #333;
|
|
padding: 10px 0;
|
|
}
|
|
|
|
.app-container {
|
|
background: white;
|
|
border-radius: 20px;
|
|
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
|
|
padding: 20px;
|
|
text-align: center;
|
|
max-width: 500px;
|
|
width: 95%;
|
|
margin: 10px auto;
|
|
}
|
|
|
|
.title {
|
|
color: #4a5568;
|
|
font-size: 2.2em;
|
|
margin-bottom: 15px;
|
|
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.flashcard {
|
|
background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
|
|
border-radius: 15px;
|
|
padding: 25px;
|
|
margin: 15px 0;
|
|
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
|
|
transition: transform 0.3s ease;
|
|
}
|
|
|
|
.flashcard:hover {
|
|
transform: scale(1.05);
|
|
}
|
|
|
|
.equation {
|
|
font-size: 3.5em;
|
|
font-weight: bold;
|
|
color: white;
|
|
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.sequence-display {
|
|
font-size: 2.2em;
|
|
font-weight: bold;
|
|
color: white;
|
|
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
|
|
margin-bottom: 15px;
|
|
line-height: 1.2;
|
|
}
|
|
|
|
.answer-section {
|
|
margin: 20px 0;
|
|
}
|
|
|
|
.answer-input {
|
|
font-size: 2.5em;
|
|
padding: 12px 15px;
|
|
border: 4px solid #667eea;
|
|
border-radius: 15px;
|
|
text-align: center;
|
|
width: 130px;
|
|
margin: 0 auto 15px auto;
|
|
display: block;
|
|
font-family: 'Nunito', sans-serif;
|
|
}
|
|
|
|
.answer-input:focus {
|
|
outline: none;
|
|
border-color: #ff9a9e;
|
|
box-shadow: 0 0 20px rgba(255, 154, 158, 0.3);
|
|
}
|
|
|
|
.buttons {
|
|
display: flex;
|
|
gap: 15px;
|
|
justify-content: center;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.btn {
|
|
font-size: 1.5em;
|
|
padding: 15px 30px;
|
|
border: none;
|
|
border-radius: 50px;
|
|
cursor: pointer;
|
|
font-family: 'Nunito', sans-serif;
|
|
font-weight: bold;
|
|
transition: all 0.3s ease;
|
|
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
|
|
}
|
|
|
|
.btn-check {
|
|
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
|
color: white;
|
|
}
|
|
|
|
.btn-next {
|
|
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
|
|
color: white;
|
|
}
|
|
|
|
.btn:hover {
|
|
transform: translateY(-3px);
|
|
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
|
|
}
|
|
|
|
.feedback {
|
|
font-size: 2.5em;
|
|
font-weight: bold;
|
|
margin: 20px 0;
|
|
padding: 20px;
|
|
border-radius: 15px;
|
|
transition: all 0.5s ease;
|
|
}
|
|
|
|
.correct {
|
|
background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
|
|
color: #2d5a27;
|
|
}
|
|
|
|
.incorrect {
|
|
background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
|
|
color: #8b4513;
|
|
}
|
|
|
|
.score {
|
|
background: rgba(255, 255, 255, 0.9);
|
|
padding: 8px 15px;
|
|
border-radius: 20px;
|
|
font-size: 1em;
|
|
font-weight: bold;
|
|
color: #4a5568;
|
|
margin-bottom: 15px;
|
|
display: inline-block;
|
|
}
|
|
|
|
.celebration {
|
|
font-size: 3em;
|
|
animation: bounce 1s infinite;
|
|
}
|
|
|
|
@keyframes bounce {
|
|
|
|
0%,
|
|
20%,
|
|
50%,
|
|
80%,
|
|
100% {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
40% {
|
|
transform: translateY(-30px);
|
|
}
|
|
|
|
60% {
|
|
transform: translateY(-15px);
|
|
}
|
|
}
|
|
|
|
.number-buttons {
|
|
display: grid;
|
|
grid-template-columns: repeat(4, 1fr);
|
|
gap: 10px;
|
|
margin: 15px 0;
|
|
}
|
|
|
|
.number-buttons .number-btn:last-child {
|
|
grid-column: span 2;
|
|
}
|
|
|
|
.number-btn {
|
|
font-size: 1.8em;
|
|
padding: 12px;
|
|
border: 3px solid #667eea;
|
|
border-radius: 12px;
|
|
background: white;
|
|
cursor: pointer;
|
|
font-family: 'Nunito', sans-serif;
|
|
font-weight: bold;
|
|
color: #667eea;
|
|
transition: all 0.2s ease;
|
|
min-height: 50px;
|
|
}
|
|
|
|
.number-btn:hover {
|
|
background: #667eea;
|
|
color: white;
|
|
transform: scale(1.1);
|
|
}
|
|
|
|
.hint {
|
|
font-size: 1.2em;
|
|
color: #666;
|
|
margin-bottom: 10px;
|
|
font-style: italic;
|
|
}
|
|
|
|
@media (max-width: 600px) {
|
|
.app-container {
|
|
padding: 15px;
|
|
margin: 5px auto;
|
|
}
|
|
|
|
.title {
|
|
font-size: 1.8em;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.equation {
|
|
font-size: 2.8em;
|
|
}
|
|
|
|
.sequence-display {
|
|
font-size: 1.8em;
|
|
}
|
|
|
|
.answer-input {
|
|
font-size: 2.2em;
|
|
width: 110px;
|
|
}
|
|
|
|
.number-btn {
|
|
font-size: 1.6em;
|
|
padding: 10px;
|
|
min-height: 45px;
|
|
}
|
|
|
|
.btn {
|
|
font-size: 1.3em;
|
|
padding: 12px 25px;
|
|
}
|
|
}
|
|
|
|
@media (max-height: 700px) {
|
|
.flashcard {
|
|
padding: 20px;
|
|
margin: 10px 0;
|
|
}
|
|
|
|
.equation {
|
|
font-size: 3em;
|
|
}
|
|
|
|
.sequence-display {
|
|
font-size: 2em;
|
|
}
|
|
|
|
.number-btn {
|
|
font-size: 1.6em;
|
|
padding: 8px;
|
|
min-height: 40px;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="app-container">
|
|
<div class="score" id="score">Score: 0/0</div>
|
|
<h1 class="title">⏭️ Skip Counting by 2s</h1>
|
|
|
|
<div class="flashcard">
|
|
<div class="hint">What comes next?</div>
|
|
<div class="sequence-display" id="sequenceDisplay">2, 4, 6, ?</div>
|
|
</div>
|
|
|
|
<div class="answer-section">
|
|
<input type="number" class="answer-input" id="answerInput" placeholder="?" min="0" max="100">
|
|
|
|
<div class="number-buttons" id="numberButtons">
|
|
<button class="number-btn" onclick="inputNumber(0)">0</button>
|
|
<button class="number-btn" onclick="inputNumber(1)">1</button>
|
|
<button class="number-btn" onclick="inputNumber(2)">2</button>
|
|
<button class="number-btn" onclick="inputNumber(3)">3</button>
|
|
<button class="number-btn" onclick="inputNumber(4)">4</button>
|
|
<button class="number-btn" onclick="inputNumber(5)">5</button>
|
|
<button class="number-btn" onclick="inputNumber(6)">6</button>
|
|
<button class="number-btn" onclick="inputNumber(7)">7</button>
|
|
<button class="number-btn" onclick="inputNumber(8)">8</button>
|
|
<button class="number-btn" onclick="inputNumber(9)">9</button>
|
|
<button class="number-btn" onclick="inputNumber(10)">10</button>
|
|
<button class="number-btn" onclick="clearAnswer()"
|
|
style="background: #ff6b6b; color: white;">Clear</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="feedback" id="feedback" style="display: none;"></div>
|
|
|
|
<div class="buttons">
|
|
<button class="btn btn-check" onclick="checkAnswer()">Check Answer! 🎯</button>
|
|
<button class="btn btn-next" onclick="nextCard()" style="display: none;" id="nextBtn">Next Card! ➡️</button>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
let currentSequence = [];
|
|
let correctAnswer;
|
|
let totalQuestions = 0;
|
|
let correctAnswers = 0;
|
|
let sequenceLength = 3; // Start with 3 numbers shown, ask for 4th
|
|
|
|
function generateNewCard() {
|
|
// Generate a random starting point for skip counting by 2s
|
|
// Start with even numbers from 0 to 10, then continue the sequence
|
|
const startNumber = Math.floor(Math.random() * 6) * 2; // 0, 2, 4, 6, 8, 10
|
|
|
|
// Create sequence of specified length
|
|
currentSequence = [];
|
|
for (let i = 0; i < sequenceLength; i++) {
|
|
currentSequence.push(startNumber + (i * 2));
|
|
}
|
|
|
|
// The correct answer is the next number in the sequence
|
|
correctAnswer = startNumber + (sequenceLength * 2);
|
|
|
|
// Display the sequence with a question mark for the next number
|
|
const sequenceDisplay = currentSequence.join(', ') + ', ?';
|
|
document.getElementById('sequenceDisplay').textContent = sequenceDisplay;
|
|
|
|
// Reset the input and feedback
|
|
document.getElementById('answerInput').value = '';
|
|
document.getElementById('feedback').style.display = 'none';
|
|
document.getElementById('nextBtn').style.display = 'none';
|
|
|
|
// Don't focus on input to prevent keyboard from showing on mobile
|
|
}
|
|
|
|
function inputNumber(num) {
|
|
const input = document.getElementById('answerInput');
|
|
const currentValue = input.value;
|
|
|
|
if (currentValue === '' || currentValue === '0') {
|
|
input.value = num;
|
|
} else if (currentValue.length < 3) { // Limit to 3 digits max for larger numbers
|
|
input.value = currentValue + num;
|
|
}
|
|
}
|
|
|
|
function clearAnswer() {
|
|
document.getElementById('answerInput').value = '';
|
|
}
|
|
|
|
function checkAnswer() {
|
|
const userAnswer = parseInt(document.getElementById('answerInput').value);
|
|
const feedbackEl = document.getElementById('feedback');
|
|
|
|
if (isNaN(userAnswer)) {
|
|
alert('Please enter a number! 😊');
|
|
return;
|
|
}
|
|
|
|
totalQuestions++;
|
|
|
|
if (userAnswer === correctAnswer) {
|
|
correctAnswers++;
|
|
feedbackEl.innerHTML = `<div class="celebration">🎉</div>Perfect! The sequence is: ${currentSequence.join(', ')}, ${correctAnswer}`;
|
|
feedbackEl.className = 'feedback correct';
|
|
|
|
// Play success sound (if browser supports it)
|
|
playSound('success');
|
|
|
|
// Gradually increase difficulty by showing longer sequences
|
|
if (correctAnswers % 5 === 0 && sequenceLength < 5) {
|
|
sequenceLength++;
|
|
}
|
|
} else {
|
|
feedbackEl.innerHTML = `<div>Try again! 💪</div>The sequence is: ${currentSequence.join(', ')}, ${correctAnswer}`;
|
|
feedbackEl.className = 'feedback incorrect';
|
|
|
|
// Play try again sound (if browser supports it)
|
|
playSound('tryAgain');
|
|
}
|
|
|
|
feedbackEl.style.display = 'block';
|
|
document.getElementById('nextBtn').style.display = 'inline-block';
|
|
|
|
updateScore();
|
|
}
|
|
|
|
function nextCard() {
|
|
generateNewCard();
|
|
}
|
|
|
|
function updateScore() {
|
|
const percentage = totalQuestions > 0 ? Math.round((correctAnswers / totalQuestions) * 100) : 0;
|
|
document.getElementById('score').textContent = `Score: ${correctAnswers}/${totalQuestions} (${percentage}%)`;
|
|
}
|
|
|
|
function playSound(type) {
|
|
// Create audio context for simple beep sounds
|
|
try {
|
|
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
|
const oscillator = audioContext.createOscillator();
|
|
const gainNode = audioContext.createGain();
|
|
|
|
oscillator.connect(gainNode);
|
|
gainNode.connect(audioContext.destination);
|
|
|
|
if (type === 'success') {
|
|
// Happy ascending notes
|
|
oscillator.frequency.setValueAtTime(523.25, audioContext.currentTime); // C5
|
|
oscillator.frequency.setValueAtTime(659.25, audioContext.currentTime + 0.1); // E5
|
|
oscillator.frequency.setValueAtTime(783.99, audioContext.currentTime + 0.2); // G5
|
|
} else {
|
|
// Gentle encouraging tone
|
|
oscillator.frequency.setValueAtTime(440, audioContext.currentTime); // A4
|
|
}
|
|
|
|
gainNode.gain.setValueAtTime(0, audioContext.currentTime);
|
|
gainNode.gain.linearRampToValueAtTime(0.1, audioContext.currentTime + 0.01);
|
|
gainNode.gain.exponentialRampToValueAtTime(0.01, audioContext.currentTime + 0.3);
|
|
|
|
oscillator.start(audioContext.currentTime);
|
|
oscillator.stop(audioContext.currentTime + 0.3);
|
|
} catch (e) {
|
|
// Audio not supported, silent fail
|
|
}
|
|
}
|
|
|
|
// Keyboard support
|
|
document.getElementById('answerInput').addEventListener('keypress', function (e) {
|
|
if (e.key === 'Enter') {
|
|
if (document.getElementById('nextBtn').style.display === 'none') {
|
|
checkAnswer();
|
|
} else {
|
|
nextCard();
|
|
}
|
|
}
|
|
});
|
|
|
|
// Initialize the first card when page loads
|
|
window.onload = function () {
|
|
generateNewCard();
|
|
updateScore();
|
|
};
|
|
|
|
// Prevent negative numbers
|
|
document.getElementById('answerInput').addEventListener('input', function (e) {
|
|
if (e.target.value < 0) {
|
|
e.target.value = 0;
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|