Manual changes saved
Browse files- index.html +39 -84
index.html
CHANGED
|
@@ -3,7 +3,9 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>
|
|
|
|
|
|
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
<script src="https://unpkg.com/feather-icons"></script>
|
| 9 |
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
|
@@ -14,25 +16,16 @@
|
|
| 14 |
}
|
| 15 |
.wheel {
|
| 16 |
transition-timing-function: cubic-bezier(0.1, 0.7, 0.1, 1);
|
| 17 |
-
box-shadow: 0 0 30px rgba(255, 215, 0, 0.9);
|
| 18 |
-
position: relative;
|
| 19 |
-
width: 100%;
|
| 20 |
-
height: 100%;
|
| 21 |
-
background: white;
|
| 22 |
}
|
| 23 |
-
.wheel-segment {
|
| 24 |
position: absolute;
|
| 25 |
width: 50%;
|
| 26 |
height: 50%;
|
| 27 |
-
top: 0;
|
| 28 |
-
left: 50%;
|
| 29 |
transform-origin: bottom right;
|
| 30 |
display: flex;
|
| 31 |
align-items: center;
|
| 32 |
justify-content: center;
|
| 33 |
clip-path: polygon(0 0, 50% 0, 100% 100%, 0 100%);
|
| 34 |
-
border: 2px solid white;
|
| 35 |
-
box-shadow: 0 0 5px rgba(0,0,0,0.3);
|
| 36 |
}
|
| 37 |
.wheel-text {
|
| 38 |
position: absolute;
|
|
@@ -41,27 +34,17 @@
|
|
| 41 |
transform-origin: center;
|
| 42 |
color: white;
|
| 43 |
font-weight: bold;
|
| 44 |
-
font-size:
|
| 45 |
-
padding: 0;
|
| 46 |
box-sizing: border-box;
|
| 47 |
-
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
|
| 48 |
-
left: 0;
|
| 49 |
-
top: 50%;
|
| 50 |
-
transform: translateY(-50%) rotate(calc(var(--segment-angle) / 2)) translateX(40%) !important;
|
| 51 |
-
z-index: 10;
|
| 52 |
-
pointer-events: none;
|
| 53 |
-
white-space: nowrap;
|
| 54 |
-
background: rgba(0,0,0,0.4);
|
| 55 |
-
padding: 0.5rem;
|
| 56 |
-
border-radius: 0.5rem;
|
| 57 |
}
|
| 58 |
.lg\:w-120 {
|
| 59 |
-
width:
|
| 60 |
}
|
| 61 |
.lg\:h-120 {
|
| 62 |
-
height:
|
| 63 |
}
|
| 64 |
-
.question-card {
|
| 65 |
transform: scale(0.95);
|
| 66 |
transition: all 0.3s ease;
|
| 67 |
}
|
|
@@ -71,33 +54,33 @@
|
|
| 71 |
}
|
| 72 |
</style>
|
| 73 |
</head>
|
| 74 |
-
<body class="bg-gradient-to-br from-purple-900 to-indigo-800 min-h-screen text-white"
|
| 75 |
-
<div class="container mx-auto px-4 py-10">
|
| 76 |
<header class="text-center mb-12">
|
| 77 |
-
<h1 class="text-4xl md:text-6xl font-bold mb-3 tracking-tight
|
| 78 |
-
<p class="text-xl text-purple-200
|
| 79 |
-
</header>
|
| 80 |
-
<div class="flex flex-col lg:flex-row items-center justify-center gap-8 lg:gap-12
|
| 81 |
-
<div class="relative w-72 h-72 md:w-96 md:h-96 lg:w-120 lg:h-120 mx-auto">
|
| 82 |
-
|
| 83 |
-
<!-- Wheel segments will be inserted here by JavaScript -->
|
| 84 |
</div>
|
| 85 |
-
<div class="absolute top-0 left-1/2 -translate-x-1/2 -mt-
|
| 86 |
-
<svg width="
|
| 87 |
<path d="M12 2L12 22M12 2L22 12M12 2L2 12"></path>
|
| 88 |
</svg>
|
| 89 |
</div>
|
| 90 |
-
<button id="spin-btn" class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-yellow-
|
| 91 |
-
<i data-feather="rotate-cw"
|
| 92 |
-
</button>
|
| 93 |
-
</div>
|
| 94 |
<div class="w-full lg:w-1/2 max-w-2xl mx-auto">
|
| 95 |
-
<div id="question-display" class="bg-white bg-opacity-
|
| 96 |
<p id="current-question" class="text-center text-2xl font-medium mb-6 text-purple-100">Presiona el botón para girar la ruleta y obtener una pregunta</p>
|
| 97 |
<button id="answer-btn" class="hidden mt-4 bg-purple-600 hover:bg-purple-500 text-white font-bold py-3 px-6 rounded-lg transition-all self-center">Mostrar Respuesta</button>
|
| 98 |
</div>
|
| 99 |
-
|
| 100 |
-
<
|
|
|
|
| 101 |
<p id="answer-text" class="text-center text-lg bg-purple-900 bg-opacity-50 rounded-lg p-4" style="display: block;"></p>
|
| 102 |
</div>
|
| 103 |
<div class="mt-8 grid grid-cols-1 md:grid-cols-2 gap-4 mx-auto max-w-md">
|
|
@@ -119,81 +102,66 @@
|
|
| 119 |
feather.replace();
|
| 120 |
const questions = [
|
| 121 |
{
|
| 122 |
-
number: "1",
|
| 123 |
question: "¿Qué es un exoplaneta?",
|
| 124 |
answer: "Un exoplaneta es un planeta que orbita una estrella diferente a nuestro Sol."
|
| 125 |
},
|
| 126 |
{
|
| 127 |
-
number: "2",
|
| 128 |
question: "¿Cómo podemos identificar un exoplaneta?",
|
| 129 |
answer: "Se puede identificar mediante el método de tránsito (midiendo la disminución de brillo de una estrella cuando el planeta pasa frente a ella)."
|
| 130 |
},
|
| 131 |
{
|
| 132 |
-
number: "3",
|
| 133 |
question: "¿Qué características tiene el exoplaneta Kepler-442b?",
|
| 134 |
answer: "Kepler-442b es una supertierra rocosa con un radio 1.34 veces el de la Tierra, orbita en la zona habitable de su estrella (una enana naranja), tiene una temperatura de equilibrio estimada de -40°C, y recibe aproximadamente el 70% de la luz solar que recibe la Tierra."
|
| 135 |
},
|
| 136 |
{
|
| 137 |
-
number: "4",
|
| 138 |
question: "¿Cuál es el ambiente del exoplaneta Kepler-442b?",
|
| 139 |
answer: "Se estima que Kepler-442b tiene una superficie rocosa con alta probabilidad de contener agua líquida en su superficie debido a que orbita en la zona habitable de su estrella. Podría tener una atmósfera similar a la terrestre."
|
| 140 |
},
|
| 141 |
-
|
| 142 |
-
number: "5",
|
| 143 |
question: "¿En qué década fueron descubiertos los primeros exoplanetas?",
|
| 144 |
answer: "En la década de 1990's"
|
| 145 |
},
|
| 146 |
{
|
| 147 |
-
number: "6",
|
| 148 |
question: "¿Por qué se le llaman supertierras a los exoplanetas?",
|
| 149 |
answer: "Se les llama supertierras porque son planetas rocosos como la Tierra pero con una masa entre 2 y 10 veces mayor. Su gravedad superficial sería más fuerte y podrían tener atmósferas más densas."
|
| 150 |
},
|
| 151 |
{
|
| 152 |
-
number: "7",
|
| 153 |
question: "¿En qué constelación está el exoplaneta Kepler-442b?",
|
| 154 |
answer: "Kepler-442b se encuentra en la constelación de Lyra."
|
| 155 |
},
|
| 156 |
{
|
| 157 |
-
number: "8",
|
| 158 |
question: "¿Qué características tiene la nave Starship 4.0?",
|
| 159 |
answer: "El Starship es un cohete totalmente reutilizable de 120m de altura, con capacidad para 100 toneladas de carga o 100 pasajeros. Usa motores Raptor que queman metano y oxígeno líquido, y está diseñado para misiones a la Luna, Marte y otros destinos del sistema solar."
|
| 160 |
},
|
| 161 |
-
|
| 162 |
-
number: "9",
|
| 163 |
question: "¿Cuáles son los nombres de los personajes en el cortometraje?",
|
| 164 |
answer: "El astronauta se llama Steve y lo acompaña Lepton, un robot humanoide"
|
| 165 |
},
|
| 166 |
{
|
| 167 |
-
number: "10",
|
| 168 |
question: "¿Consideras que es importante la exploración espacial?",
|
| 169 |
answer: "(Pregunta abierta)"
|
| 170 |
},
|
| 171 |
{
|
| 172 |
-
number: "11",
|
| 173 |
question: "¿Te gustaría vivir en un exoplaneta? ¿Por qué?",
|
| 174 |
answer: "(Respuesta abierta)"
|
| 175 |
},
|
| 176 |
{
|
| 177 |
-
number: "12",
|
| 178 |
question: "¿Por qué se dice que el exoplaneta Kepler-442b se parece a la tierra?",
|
| 179 |
answer: "Kepler-442b se considera similar a la Tierra porque: 1) Es rocoso, 2) Orbita en la zona habitable de su estrella, 3) Tiene un tamaño similar (1.34 radios terrestres), 4) Probablemente tiene agua líquida, y 5) Recibe una cantidad de luz estelar similar (70% de lo que recibe la Tierra del Sol)."
|
| 180 |
},
|
| 181 |
-
|
| 182 |
-
number: "13",
|
| 183 |
question: "¿Consideras que el cortometraje te ayudo a aprender sobre los exoplanetas?",
|
| 184 |
answer: "(Pregunta abierta)"
|
| 185 |
},
|
| 186 |
{
|
| 187 |
-
number: "14",
|
| 188 |
question: "¿Qué cosas consideras que debe tener el exoplaneta Kepler-442b si queremos vivir allá?",
|
| 189 |
answer: "(Pregunta abierta)"
|
| 190 |
}
|
| 191 |
-
];
|
| 192 |
let remainingQuestions = [...questions];
|
| 193 |
let currentQuestion = null;
|
| 194 |
let isSpinning = false;
|
| 195 |
|
| 196 |
-
// Create wheel segments
|
| 197 |
const wheel = document.getElementById('wheel');
|
| 198 |
const colors = [
|
| 199 |
'bg-red-500', 'bg-blue-500', 'bg-green-500', 'bg-yellow-500',
|
|
@@ -209,15 +177,12 @@ let remainingQuestions = [...questions];
|
|
| 209 |
|
| 210 |
const questionText = document.createElement('div');
|
| 211 |
questionText.className = 'wheel-text';
|
| 212 |
-
questionText.style.
|
| 213 |
-
questionText.textContent = q.
|
| 214 |
-
|
| 215 |
segment.appendChild(questionText);
|
| 216 |
wheel.appendChild(segment);
|
| 217 |
-
|
| 218 |
-
void wheel.offsetWidth;
|
| 219 |
-
});
|
| 220 |
-
// Spin the wheel
|
| 221 |
document.getElementById('spin-btn').addEventListener('click', () => {
|
| 222 |
if (isSpinning || remainingQuestions.length === 0) return;
|
| 223 |
|
|
@@ -227,30 +192,23 @@ let remainingQuestions = [...questions];
|
|
| 227 |
spinBtn.innerHTML = '<i data-feather="loader" class="animate-spin"></i>';
|
| 228 |
feather.replace();
|
| 229 |
|
| 230 |
-
// Random stop position
|
| 231 |
const segmentAngle = 360 / questions.length;
|
| 232 |
const stopRotation = Math.floor(Math.random() * 360);
|
| 233 |
const selectedSegment = Math.floor(stopRotation / segmentAngle);
|
| 234 |
|
| 235 |
-
// Ensure we don't repeat questions
|
| 236 |
let adjustedIndex = selectedSegment % remainingQuestions.length;
|
| 237 |
currentQuestion = remainingQuestions[adjustedIndex];
|
| 238 |
remainingQuestions.splice(adjustedIndex, 1);
|
| 239 |
-
// Spin animation
|
| 240 |
wheel.style.setProperty('--stop-rotation', `${stopRotation}deg`);
|
| 241 |
-
wheel.style.animation = 'spin 5s
|
| 242 |
setTimeout(() => {
|
| 243 |
-
// Reset animation before applying new transform
|
| 244 |
-
setTimeout(() => {
|
| 245 |
wheel.style.animation = 'none';
|
| 246 |
wheel.style.transform = `rotate(${stopRotation}deg)`;
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
document.getElementById('current-question').textContent = `Número ${currentQuestion.number}: ${currentQuestion.question}`;
|
| 250 |
document.getElementById('answer-btn').classList.remove('hidden');
|
| 251 |
document.getElementById('answer-text').classList.add('hidden');
|
| 252 |
|
| 253 |
-
// Update counters
|
| 254 |
document.getElementById('questions-left').textContent = remainingQuestions.length;
|
| 255 |
document.getElementById('questions-answered').textContent = questions.length - remainingQuestions.length;
|
| 256 |
|
|
@@ -260,7 +218,6 @@ document.getElementById('answer-btn').classList.remove('hidden');
|
|
| 260 |
feather.replace();
|
| 261 |
}, 7000);
|
| 262 |
});
|
| 263 |
-
// Show answer
|
| 264 |
document.getElementById('answer-btn').addEventListener('click', () => {
|
| 265 |
document.getElementById('answer-text').textContent = currentQuestion.answer || "Esta pregunta no tiene una respuesta definida. ¡Piensa en tu propia respuesta!";
|
| 266 |
document.getElementById('answer-display').classList.remove('hidden');
|
|
@@ -268,12 +225,10 @@ document.getElementById('answer-btn').classList.remove('hidden');
|
|
| 268 |
document.getElementById('answer-text').style.display = 'block';
|
| 269 |
});
|
| 270 |
|
| 271 |
-
// Reset answer display on new spin
|
| 272 |
document.getElementById('spin-btn').addEventListener('click', () => {
|
| 273 |
document.getElementById('answer-display').classList.add('hidden');
|
| 274 |
});
|
| 275 |
-
// Reset wheel position on load
|
| 276 |
wheel.style.transform = 'rotate(0deg)';
|
| 277 |
</script>
|
| 278 |
</body>
|
| 279 |
-
</html>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Ruleta exoplanetaria</title>
|
| 7 |
+
<title>Calculadora de huella de carbono COLBOYD</title>
|
| 8 |
+
<link rel="icon" href="icon" type="image/png">
|
| 9 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 10 |
<script src="https://unpkg.com/feather-icons"></script>
|
| 11 |
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
|
|
|
| 16 |
}
|
| 17 |
.wheel {
|
| 18 |
transition-timing-function: cubic-bezier(0.1, 0.7, 0.1, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
}
|
| 20 |
+
.wheel-segment {
|
| 21 |
position: absolute;
|
| 22 |
width: 50%;
|
| 23 |
height: 50%;
|
|
|
|
|
|
|
| 24 |
transform-origin: bottom right;
|
| 25 |
display: flex;
|
| 26 |
align-items: center;
|
| 27 |
justify-content: center;
|
| 28 |
clip-path: polygon(0 0, 50% 0, 100% 100%, 0 100%);
|
|
|
|
|
|
|
| 29 |
}
|
| 30 |
.wheel-text {
|
| 31 |
position: absolute;
|
|
|
|
| 34 |
transform-origin: center;
|
| 35 |
color: white;
|
| 36 |
font-weight: bold;
|
| 37 |
+
font-size: 0.8rem;
|
| 38 |
+
padding: 0 10px;
|
| 39 |
box-sizing: border-box;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
}
|
| 41 |
.lg\:w-120 {
|
| 42 |
+
width: 30rem;
|
| 43 |
}
|
| 44 |
.lg\:h-120 {
|
| 45 |
+
height: 30rem;
|
| 46 |
}
|
| 47 |
+
.question-card {
|
| 48 |
transform: scale(0.95);
|
| 49 |
transition: all 0.3s ease;
|
| 50 |
}
|
|
|
|
| 54 |
}
|
| 55 |
</style>
|
| 56 |
</head>
|
| 57 |
+
<body class="bg-gradient-to-br from-purple-900 to-indigo-800 min-h-screen text-white">
|
| 58 |
+
<div class="container mx-auto px-4 py-10">
|
| 59 |
<header class="text-center mb-12">
|
| 60 |
+
<h1 class="text-4xl md:text-6xl font-bold mb-3 tracking-tight">Spin & Win Trivia</h1>
|
| 61 |
+
<p class="text-xl text-purple-200">Gira la ruleta y responde 15 preguntas divertidas</p>
|
| 62 |
+
</header>
|
| 63 |
+
<div class="flex flex-col lg:flex-row items-center justify-center gap-8 lg:gap-12">
|
| 64 |
+
<div class="relative w-72 h-72 md:w-96 md:h-96 lg:w-120 lg:h-120 mx-auto">
|
| 65 |
+
<div id="wheel" class="wheel w-full h-full rounded-full border-8 border-yellow-400 bg-white relative overflow-hidden transition-transform duration-5000">
|
|
|
|
| 66 |
</div>
|
| 67 |
+
<div class="absolute top-0 left-1/2 -translate-x-1/2 -mt-4">
|
| 68 |
+
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-yellow-400">
|
| 69 |
<path d="M12 2L12 22M12 2L22 12M12 2L2 12"></path>
|
| 70 |
</svg>
|
| 71 |
</div>
|
| 72 |
+
<button id="spin-btn" class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-yellow-400 hover:bg-yellow-300 text-purple-900 font-bold w-16 h-16 rounded-full flex items-center justify-center transition-all shadow-lg hover:shadow-xl focus:outline-none focus:ring-2 focus:ring-yellow-200">
|
| 73 |
+
<i data-feather="rotate-cw"></i>
|
| 74 |
+
</button>
|
| 75 |
+
</div>
|
| 76 |
<div class="w-full lg:w-1/2 max-w-2xl mx-auto">
|
| 77 |
+
<div id="question-display" class="bg-white bg-opacity-10 backdrop-filter backdrop-blur-lg rounded-xl p-6 shadow-xl min-h-64 flex flex-col justify-center mx-4">
|
| 78 |
<p id="current-question" class="text-center text-2xl font-medium mb-6 text-purple-100">Presiona el botón para girar la ruleta y obtener una pregunta</p>
|
| 79 |
<button id="answer-btn" class="hidden mt-4 bg-purple-600 hover:bg-purple-500 text-white font-bold py-3 px-6 rounded-lg transition-all self-center">Mostrar Respuesta</button>
|
| 80 |
</div>
|
| 81 |
+
|
| 82 |
+
<div id="answer-display" class="hidden mt-6 bg-white bg-opacity-10 backdrop-filter backdrop-blur-lg rounded-xl p-6 shadow-xl">
|
| 83 |
+
<h3 class="text-xl font-bold text-center text-yellow-300 mb-4">Respuesta:</h3>
|
| 84 |
<p id="answer-text" class="text-center text-lg bg-purple-900 bg-opacity-50 rounded-lg p-4" style="display: block;"></p>
|
| 85 |
</div>
|
| 86 |
<div class="mt-8 grid grid-cols-1 md:grid-cols-2 gap-4 mx-auto max-w-md">
|
|
|
|
| 102 |
feather.replace();
|
| 103 |
const questions = [
|
| 104 |
{
|
|
|
|
| 105 |
question: "¿Qué es un exoplaneta?",
|
| 106 |
answer: "Un exoplaneta es un planeta que orbita una estrella diferente a nuestro Sol."
|
| 107 |
},
|
| 108 |
{
|
|
|
|
| 109 |
question: "¿Cómo podemos identificar un exoplaneta?",
|
| 110 |
answer: "Se puede identificar mediante el método de tránsito (midiendo la disminución de brillo de una estrella cuando el planeta pasa frente a ella)."
|
| 111 |
},
|
| 112 |
{
|
|
|
|
| 113 |
question: "¿Qué características tiene el exoplaneta Kepler-442b?",
|
| 114 |
answer: "Kepler-442b es una supertierra rocosa con un radio 1.34 veces el de la Tierra, orbita en la zona habitable de su estrella (una enana naranja), tiene una temperatura de equilibrio estimada de -40°C, y recibe aproximadamente el 70% de la luz solar que recibe la Tierra."
|
| 115 |
},
|
| 116 |
{
|
|
|
|
| 117 |
question: "¿Cuál es el ambiente del exoplaneta Kepler-442b?",
|
| 118 |
answer: "Se estima que Kepler-442b tiene una superficie rocosa con alta probabilidad de contener agua líquida en su superficie debido a que orbita en la zona habitable de su estrella. Podría tener una atmósfera similar a la terrestre."
|
| 119 |
},
|
| 120 |
+
{
|
|
|
|
| 121 |
question: "¿En qué década fueron descubiertos los primeros exoplanetas?",
|
| 122 |
answer: "En la década de 1990's"
|
| 123 |
},
|
| 124 |
{
|
|
|
|
| 125 |
question: "¿Por qué se le llaman supertierras a los exoplanetas?",
|
| 126 |
answer: "Se les llama supertierras porque son planetas rocosos como la Tierra pero con una masa entre 2 y 10 veces mayor. Su gravedad superficial sería más fuerte y podrían tener atmósferas más densas."
|
| 127 |
},
|
| 128 |
{
|
|
|
|
| 129 |
question: "¿En qué constelación está el exoplaneta Kepler-442b?",
|
| 130 |
answer: "Kepler-442b se encuentra en la constelación de Lyra."
|
| 131 |
},
|
| 132 |
{
|
|
|
|
| 133 |
question: "¿Qué características tiene la nave Starship 4.0?",
|
| 134 |
answer: "El Starship es un cohete totalmente reutilizable de 120m de altura, con capacidad para 100 toneladas de carga o 100 pasajeros. Usa motores Raptor que queman metano y oxígeno líquido, y está diseñado para misiones a la Luna, Marte y otros destinos del sistema solar."
|
| 135 |
},
|
| 136 |
+
{
|
|
|
|
| 137 |
question: "¿Cuáles son los nombres de los personajes en el cortometraje?",
|
| 138 |
answer: "El astronauta se llama Steve y lo acompaña Lepton, un robot humanoide"
|
| 139 |
},
|
| 140 |
{
|
|
|
|
| 141 |
question: "¿Consideras que es importante la exploración espacial?",
|
| 142 |
answer: "(Pregunta abierta)"
|
| 143 |
},
|
| 144 |
{
|
|
|
|
| 145 |
question: "¿Te gustaría vivir en un exoplaneta? ¿Por qué?",
|
| 146 |
answer: "(Respuesta abierta)"
|
| 147 |
},
|
| 148 |
{
|
|
|
|
| 149 |
question: "¿Por qué se dice que el exoplaneta Kepler-442b se parece a la tierra?",
|
| 150 |
answer: "Kepler-442b se considera similar a la Tierra porque: 1) Es rocoso, 2) Orbita en la zona habitable de su estrella, 3) Tiene un tamaño similar (1.34 radios terrestres), 4) Probablemente tiene agua líquida, y 5) Recibe una cantidad de luz estelar similar (70% de lo que recibe la Tierra del Sol)."
|
| 151 |
},
|
| 152 |
+
{
|
|
|
|
| 153 |
question: "¿Consideras que el cortometraje te ayudo a aprender sobre los exoplanetas?",
|
| 154 |
answer: "(Pregunta abierta)"
|
| 155 |
},
|
| 156 |
{
|
|
|
|
| 157 |
question: "¿Qué cosas consideras que debe tener el exoplaneta Kepler-442b si queremos vivir allá?",
|
| 158 |
answer: "(Pregunta abierta)"
|
| 159 |
}
|
| 160 |
+
];
|
| 161 |
let remainingQuestions = [...questions];
|
| 162 |
let currentQuestion = null;
|
| 163 |
let isSpinning = false;
|
| 164 |
|
|
|
|
| 165 |
const wheel = document.getElementById('wheel');
|
| 166 |
const colors = [
|
| 167 |
'bg-red-500', 'bg-blue-500', 'bg-green-500', 'bg-yellow-500',
|
|
|
|
| 177 |
|
| 178 |
const questionText = document.createElement('div');
|
| 179 |
questionText.className = 'wheel-text';
|
| 180 |
+
questionText.style.transform = `rotate(${angle + (360 / questions.length / 2)}deg)`;
|
| 181 |
+
questionText.textContent = q.question;
|
| 182 |
+
|
| 183 |
segment.appendChild(questionText);
|
| 184 |
wheel.appendChild(segment);
|
| 185 |
+
});
|
|
|
|
|
|
|
|
|
|
| 186 |
document.getElementById('spin-btn').addEventListener('click', () => {
|
| 187 |
if (isSpinning || remainingQuestions.length === 0) return;
|
| 188 |
|
|
|
|
| 192 |
spinBtn.innerHTML = '<i data-feather="loader" class="animate-spin"></i>';
|
| 193 |
feather.replace();
|
| 194 |
|
|
|
|
| 195 |
const segmentAngle = 360 / questions.length;
|
| 196 |
const stopRotation = Math.floor(Math.random() * 360);
|
| 197 |
const selectedSegment = Math.floor(stopRotation / segmentAngle);
|
| 198 |
|
|
|
|
| 199 |
let adjustedIndex = selectedSegment % remainingQuestions.length;
|
| 200 |
currentQuestion = remainingQuestions[adjustedIndex];
|
| 201 |
remainingQuestions.splice(adjustedIndex, 1);
|
|
|
|
| 202 |
wheel.style.setProperty('--stop-rotation', `${stopRotation}deg`);
|
| 203 |
+
wheel.style.animation = 'spin 5s forwards';
|
| 204 |
setTimeout(() => {
|
|
|
|
|
|
|
| 205 |
wheel.style.animation = 'none';
|
| 206 |
wheel.style.transform = `rotate(${stopRotation}deg)`;
|
| 207 |
+
|
| 208 |
+
document.getElementById('current-question').textContent = `Pregunta: ${currentQuestion.question}`;
|
|
|
|
| 209 |
document.getElementById('answer-btn').classList.remove('hidden');
|
| 210 |
document.getElementById('answer-text').classList.add('hidden');
|
| 211 |
|
|
|
|
| 212 |
document.getElementById('questions-left').textContent = remainingQuestions.length;
|
| 213 |
document.getElementById('questions-answered').textContent = questions.length - remainingQuestions.length;
|
| 214 |
|
|
|
|
| 218 |
feather.replace();
|
| 219 |
}, 7000);
|
| 220 |
});
|
|
|
|
| 221 |
document.getElementById('answer-btn').addEventListener('click', () => {
|
| 222 |
document.getElementById('answer-text').textContent = currentQuestion.answer || "Esta pregunta no tiene una respuesta definida. ¡Piensa en tu propia respuesta!";
|
| 223 |
document.getElementById('answer-display').classList.remove('hidden');
|
|
|
|
| 225 |
document.getElementById('answer-text').style.display = 'block';
|
| 226 |
});
|
| 227 |
|
|
|
|
| 228 |
document.getElementById('spin-btn').addEventListener('click', () => {
|
| 229 |
document.getElementById('answer-display').classList.add('hidden');
|
| 230 |
});
|
|
|
|
| 231 |
wheel.style.transform = 'rotate(0deg)';
|
| 232 |
</script>
|
| 233 |
</body>
|
| 234 |
+
</html>
|