would-you-rather / index.html
kai774's picture
“Add an animated background effect to the app. The background should include subtle moving elements (like floating stickers, glowing particles, mist, or light flares) that loop continuously. Make sure the animations are smooth, not distracting, and give the app a cool, game-like vibe while the user plays. The questions and choices must stay clear and easy to read above the background.” - Initial Deployment
1bd01a6 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Would You Rather – Vampire Diaries Survival</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Montserrat:wght@300;400;600&display=swap');
body {
font-family: 'Montserrat', sans-serif;
background-color: #0f0f1a;
color: #e0e0e0;
background-image: radial-gradient(circle at 50% 50%, rgba(70, 0, 20, 0.1) 0%, rgba(0, 0, 0, 0.9) 100%);
min-height: 100vh;
overflow-x: hidden;
position: relative;
}
.vampire-title {
font-family: 'Cinzel', serif;
text-shadow: 0 0 10px rgba(180, 0, 0, 0.7);
}
.choice-btn {
transition: all 0.3s ease;
transform-origin: center;
}
.choice-btn:hover {
transform: scale(1.03);
box-shadow: 0 0 15px rgba(180, 0, 0, 0.5);
}
.blood-drip {
position: absolute;
width: 100%;
height: 100%;
pointer-events: none;
background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M50 0 L55 20 L60 15 L65 30 L70 25 L75 40 L80 35 L85 50 L90 45 L95 60 L100 55 L95 70 L90 65 L85 80 L80 75 L75 90 L70 85 L65 100 L60 95 L55 100 L50 95 L45 100 L40 95 L35 100 L30 95 L25 100 L20 95 L15 100 L10 95 L5 100 L0 95 L5 80 L10 85 L15 70 L20 75 L25 60 L30 65 L35 50 L40 55 L45 40 L50 45 L55 30 L60 35 L65 20 L70 25 L75 10 L80 15 L85 0 L80 5 L75 0 L70 5 L65 0 L60 5 L55 0 L50 5 L45 0 L40 5 L35 0 L30 5 L25 0 L20 5 L15 0 L10 5 L5 0 Z' fill='rgba(180, 0, 0, 0.05)' /%3E%3C/svg%3E");
opacity: 0.3;
z-index: -1;
}
.progress-bar {
height: 5px;
background: linear-gradient(90deg, rgba(180,0,0,1) 0%, rgba(80,0,0,1) 100%);
transition: width 0.5s ease;
}
.question-card {
background: rgba(15, 15, 30, 0.8);
backdrop-filter: blur(5px);
border: 1px solid rgba(180, 0, 0, 0.3);
box-shadow: 0 0 20px rgba(180, 0, 0, 0.2);
}
.ending-win {
background: linear-gradient(135deg, rgba(20,50,20,0.8) 0%, rgba(10,25,10,0.9) 100%);
border: 1px solid rgba(0, 180, 0, 0.3);
box-shadow: 0 0 20px rgba(0, 180, 0, 0.2);
}
.ending-lose {
background: linear-gradient(135deg, rgba(50,20,20,0.8) 0%, rgba(25,10,10,0.9) 100%);
border: 1px solid rgba(180, 0, 0, 0.3);
box-shadow: 极 0 20px rgba(180, 0, 0, 0.2);
}
/* Animated Background Elements */
.animated-background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: -2;
overflow: hidden;
}
.particle {
position: absolute;
border-radius: 50%;
background: radial-gradient(circle, rgba(180, 0, 0, 0.3) 0%, transparent 70%);
animation: float 15s infinite ease-in-out;
opacity: 0.4;
}
.mist {
position: absolute;
width: 150%;
height: 150%;
background: radial-gradient(ellipse at center, rgba(100, 0, 50, 0.1) 0%, transparent 70%);
animation: drift 30s infinite linear;
opacity: 0.2;
}
.light-flare {
position: absolute;
width: 200px;
height: 200px;
border-radius: 50%;
background: radial-gradient(circle, rgba(255, 0, 100, 0.15) 0%, transparent 70%);
filter: blur(15px);
animation: pulse 8s infinite alternate;
opacity: 0.3;
}
.vampire-symbol {
position: absolute;
font-size: 40px;
color: rgba(180, 0, 0, 0.1);
animation: float-symbol 25s infinite ease-in-out;
opacity: 0.2;
}
@keyframes float {
0%, 100% {
transform: translate(0, 0) rotate(0deg);
}
25% {
transform: translate(20px, -15px) rotate(5deg);
}
50% {
transform: translate(-15px, 10px) rotate(-5deg);
}
75% {
transform: translate(10px, 15px) rotate(3deg);
}
}
@keyframes drift {
0% {
transform: translate(-25%, -25%) rotate(0deg);
}
100% {
transform: translate(-25%, -25%) rotate(360deg);
}
}
@keyframes pulse {
0% {
transform: scale(1);
opacity: 0.2;
}
100% {
transform: scale(1.5);
opacity: 0.4;
}
}
@keyframes float-symbol {
0%, 100% {
transform: translate(0, 0) rotate(0deg);
opacity: 0.2;
}
50% {
transform: translate(50px, -30px) rotate(180deg);
opacity: 0.3;
}
}
</style>
</head>
<body class="flex flex-col items-center justify-start min-h-screen pt-10 pb-20 px-4">
<div class="blood-drip"></div>
<!-- Animated Background -->
<div class="animated-background" id="animated-background">
<!-- Elements will be generated by JavaScript -->
</div>
<div class="w-full max-w-2xl mx-auto">
<!-- Game Header -->
<header class="text-center mb-10">
<h1 class="vampire-title text-4xl md:text-5xl font-bold mb-4 text-red-600">Would You Rather</h1>
<h2 class="text-xl md:text-2xl font-semibold text-red-400 mb-2">Vampire Diaries Survival</h2>
<p class="text-gray-300">Make your choices carefully. Your survival depends on it.</p>
</header>
<!-- Progress Bar -->
<div class="mb-6">
<div class="flex justify-between text-sm text-gray-400 mb-1">
<span>Question <span id="current-question">1</span>/25</span>
<span id="progress-percent">4%</span>
</div>
<div class="w-full bg-gray-800 rounded-full h-2">
<div id="progress-bar" class="progress-bar rounded-full h-2" style="width: 4%"></div>
</div>
</div>
<!-- Question Container -->
<div id="question-container" class="question-card rounded-lg p-6 mb-8">
<h3 id="question-text" class="text-xl font-semibold mb-6 text-center">Damon offers you his blood after you're badly hurt.</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<button
onclick="selectChoice('A')"
class="choice-btn bg-gray-800 hover:bg-red-900 text-white py-4 px-6 rounded-lg border border-red-900 flex items-center justify-center"
>
<span class="font-bold mr-2 text-red-400">A)</span>
<span>Drink it immediately</span>
</button>
<button
onclick="selectChoice('B')"
class="choice-btn bg-gray-800 hover:bg-red-900 text-white py-4 px-6 rounded-lg border border-red-900 flex items-center justify-center"
>
<span class="font-bold mr-2 text-red-400">B)</span>
<span>Refuse and risk dying</span>
</button>
</div>
</div>
<!-- Results Container (Hidden Initially) -->
<div id="results-container" class="hidden">
<div id="ending-card" class="rounded-lg p-8 mb-8 text-center">
<h2 id="ending-title" class="text-3xl font-bold mb-4"></h2>
<p id="ending-text" class="text-xl mb-6"></p>
<div class="mb-6">
<p class="text-2xl font-semibold mb-2">Your Score:</p>
<p id="final-score" class="text-4xl font-bold"></p>
</div>
</div>
<div class="question-card rounded-lg p-6">
<h3 class="text-xl font-semibold mb-4 text-center">Your Answers:</h3>
<div id="answers-list" class="space-y-4"></div>
</div>
<div class="mt-6 text-center">
<button
onclick="restartGame()"
class="bg-red-800 hover:bg-red-700 text-white py-3 px-8 rounded-lg font-semibold transition-all"
>
Play Again
</button>
</div>
</div>
</div>
<!-- Welcome Modal -->
<div id="welcome-modal" class="fixed inset-0 bg-black bg-opacity-80 flex items-center justify-center z-50" style="display: flex;">
<div class="bg-gray-900 border-2 border-red-700 rounded-lg p-8 mx-4 max-w-md text-center">
<h2 class="vampire-title text-2xl md:text-3xl font-bold mb-6 text-red-600">Welcome to the Game!</h2>
<p class="text-lg mb-6 text-gray-300">
If you lose, you are fat. If you win, you are not fat. Play through Erika's story and at the end you will discover your fate!
</p>
<button
onclick="closeWelcomeModal()"
class="bg-red-800 hover:bg-red-700 text-white py-3 px-8 rounded-lg font-semibold transition-all"
>
I Understand
</button>
</div>
</div>
<script>
// Welcome Modal Function
function closeWelcomeModal() {
document.getElementById('welcome-modal').style.display = 'none';
initGame();
}
// Animated Background Setup
function createAnimatedBackground() {
const container = document.getElementById('animated-background');
// Create particles
for (let i = 0; i < 15; i++) {
const particle = document.createElement('div');
particle.classList.add('particle');
particle.style.width = Math.random() * 20 + 10 + 'px';
particle.style.height = particle.style.width;
particle.style.left = Math.random() * 100 + '%';
particle.style.top = Math.random() * 100 + '%';
particle.style.animationDelay = Math.random() * 15 + 's';
particle.style.animationDuration = (Math.random() * 10 + 15) + 's';
container.appendChild(particle);
}
// Create mist layers
for (let i = 0; i < 2; i++) {
const mist = document.createElement('div');
mist.classList.add('mist');
mist.style.animationDuration = (Math.random() * 10 + 25) + 's';
container.appendChild(mist);
}
// Create light flares
for (let i = 0; i < 3; i++) {
const flare = document.createElement('div');
flare.classList.add('light-flare');
flare.style.left = Math.random() * 100 + '%';
flare.style.top = Math.random() * 100 + '%';
flare.style.animationDelay = Math.random() * 8 + 's';
container.appendChild(flare);
}
// Create vampire symbols
for (let i = 0; i < 5; i++) {
const symbol = document.createElement('div');
symbol.classList.add('vampire-symbol');
symbol.innerHTML = '♰';
symbol.style.left = Math.random() * 100 + '%';
symbol.style.top = Math.random() * 100 + '%';
symbol.style.animationDelay = Math.random() * 25 + 's';
container.appendChild(symbol);
}
}
// Game Data
const questions = [
{
question: "Damon offers you his blood after you're badly hurt.",
choices: {
A: { text: "Drink it immediately", correct: true },
B: { text: "Refuse and risk dying", correct: false }
}
},
{
question: "Stefan asks you to help him lock Damon in the cellar.",
choices: {
A: { text: "Agree to help Stefan", correct: true },
B: { text: "Betray Stefan and free Damon", correct: false }
}
},
{
question: "Katherine lures you with a deal for power.",
choices: {
A: { text: "Accept her deal", correct: false },
B: { text: "Refuse and stay cautious", correct: true }
}
},
{
question: "Klaus demands your loyalty.",
choices: {
A: { text: "Swear allegiance to Klaus", correct: false },
B: { text: "Secretly plan against him", correct: true }
}
},
{
question: "Bonnie offers you a daylight ring.",
choices: {
A: { text: "Take it gratefully", correct: true },
B: { text: "Decline, you don't trust magic", correct: false }
}
},
{
question: "You're ambushed by werewolves at night.",
choices: {
A: { text: "Run into the forest", correct: false },
B: { text: "Stay and fight with vervain weapons", correct: true }
}
},
{
question: "Damon asks: 'Kill or spare this vampire?'",
choices: {
A: { text: "Kill", correct: true },
B: { text: "Spare", correct: false }
}
},
{
question: "You find Elena crying.",
choices: {
A: { text: "Comfort her", correct: true },
B: { text: "Leave her alone", correct: false }
}
},
{
question: "Stefan is starving and wants blood.",
choices: {
A: { text: "Offer him your blood", correct: true },
B: { text: "Walk away", correct: false }
}
},
{
question: "You discover the Originals' secret.",
choices: {
A: { text: "Keep it to yourself", correct: true },
B: { text: "Tell everyone in Mystic Falls", correct: false }
}
},
{
question: "Rebekah offers friendship.",
choices: {
A: { text: "Accept it", correct: true },
B: { text: "Reject her coldly", correct: false }
}
},
{
question: "You're locked in a room with Damon.",
choices: {
A: { text: "Trust him to protect you", correct: true },
B: { text: "Try to escape", correct: false }
}
},
{
question: "You find a white oak stake.",
choices: {
A: { text: "Hide it safely", correct: true },
B: { text: "Wave it around carelessly", correct: false }
}
},
{
question: "Klaus tells you to betray your friends.",
choices: {
A: { text: "Pretend to agree, then betray him instead", correct: true },
B: { text: "Actually betray your friends", correct: false }
}
},
{
question: "Jeremy asks you to help him hunt vampires.",
choices: {
A: { text: "Train him carefully", correct: true },
B: { text: "Refuse to get involved", correct: false }
}
},
{
question: "Caroline asks for your advice on Tyler.",
choices: {
A: { text: "Tell her the truth", correct: true },
B: { text: "Lie to protect her", correct: false }
}
},
{
question: "A stranger vampire offers you power.",
choices: {
A: { text: "Refuse", correct: true },
B: { text: "Accept", correct: false }
}
},
{
question: "You're caught in fire with Damon.",
choices: {
A: { text: "Save Damon first", correct: true },
B: { text: "Save yourself", correct: false }
}
},
{
question: "Alaric hands you his ring.",
choices: {
A: { text: "Accept and use it", correct: true },
B: { text: "Refuse", correct: false }
}
},
{
question: "Bonnie collapses after a spell.",
choices: {
A: { text: "Carry her to safety", correct: true },
B: { text: "Leave her", correct: false }
}
},
{
question: "Damon says: 'Choose me or Stefan.'",
choices: {
A: { text: "Choose Damon", correct: true },
B: { text: "Choose Stefan", correct: false }
}
},
{
question: "You discover Elena is in danger.",
choices: {
A: { text: "Warn her immediately", correct: true },
B: { text: "Do nothing", correct: false }
}
},
{
question: "You have a chance to kill Klaus.",
choices: {
A: { text: "Try it smartly", correct: true },
B: { text: "Walk away", correct: false }
}
},
{
question: "Elijah asks for your trust.",
choices: {
A: { text: "Give him a chance", correct: true },
B: { text: "Reject him", correct: false }
}
},
{
question: "Last choice: Would you rather...",
choices: {
A: { text: "Stay human", correct: false },
B: { text: "Become a vampire", correct: true }
}
}
];
// Game State
let currentQuestionIndex = 0;
const playerAnswers = [];
let score = 0;
// DOM Elements
const questionText = document.getElementById('question-text');
const choiceABtn = document.querySelector('button[onclick="selectChoice(\'A\')"]');
const choiceBBtn = document.querySelector('button[onclick="selectChoice(\'B\')"]');
const currentQuestionDisplay = document.getElementById('current-question');
const progressBar = document.getElementById('progress-bar');
const progressPercent = document.getElementById('progress-percent');
const questionContainer = document.getElementById('question-container');
const resultsContainer = document.getElementById('results-container');
const endingTitle = document.getElementById('ending-title');
const endingText = document.getElementById('ending-text');
const finalScore = document.getElementById('final-score');
const answersList = document.getElementById('answers-list');
const endingCard = document.getElementById('ending-card');
// Initialize the game
function initGame() {
currentQuestionIndex = 0;
playerAnswers.length = 0;
score = 0;
updateQuestion();
questionContainer.classList.remove('hidden');
resultsContainer.classList.add('hidden');
}
// Update the current question display
function updateQuestion() {
const question = questions[currentQuestionIndex];
questionText.textContent = question.question;
const choiceA = question.choices.A;
const choiceB = question.choices.B;
choiceABtn.innerHTML = `<span class="font-bold mr-2 text-red-400">A)</span><span>${choiceA.text}</span>`;
choiceBBtn.innerHTML = `<span class="font-bold mr-2 text-red-400">B)</span><span>${choiceB.text}</span>`;
currentQuestionDisplay.textContent = currentQuestionIndex + 1;
const progress = ((currentQuestionIndex + 1) / questions.length) * 100;
progressBar.style.width = `${progress}%`;
progressPercent.textContent = `${Math.round(progress)}%`;
}
// Handle choice selection
function selectChoice(choice) {
const question = questions[currentQuestionIndex];
const selectedChoice = question.choices[choice];
const isCorrect = selectedChoice.correct;
playerAnswers.push({
question: question.question,
choice: choice,
text: selectedChoice.text,
correct: isCorrect
});
if (isCorrect) {
score++;
}
// Move to next question or end game
if (currentQuestionIndex < questions.length - 1) {
currentQuestionIndex++;
updateQuestion();
} else {
endGame();
}
}
// End the game and show results
function endGame() {
questionContainer.classList.add('hidden');
resultsContainer.classList.remove('hidden');
// Set ending based on score
if (score >= 15) {
endingTitle.textContent = "You Survived Mystic Falls!";
endingText.textContent = "You made the right choices. Erica becomes a powerful vampire and thrives in the supernatural world.";
endingCard.classList.add('ending-win');
endingCard.classList.remove('ending-lose');
} else {
endingTitle.textContent = "You Failed to Survive";
endingText.textContent = "Your choices led to tragedy. Erica's story ends mysteriously in the shadows of Mystic Falls.";
endingCard.classList.add('ending-lose');
endingCard.classList.remove('ending-win');
}
finalScore.textContent = `${score}/25`;
// Display all answers
answersList.innerHTML = '';
playerAnswers.forEach((answer, index) => {
const answerItem = document.createElement('div');
answerItem.className = 'p-4 border-b border-gray-700';
answerItem.innerHTML = `
<div class="flex justify-between items-start mb-2">
<span class="font-semibold">Question ${index + 1}:</span>
<span class="ml-4 ${answer.correct ? 'text-green-400' : 'text-red-400'}">
${answer.correct ? '✅ Correct' : '❌ Wrong'}
</span>
</div>
<p class="text-gray-300 mb-1">${answer.question}</p>
<p class="text-gray-400">Your choice: ${answer.choice}) ${answer.text}</p>
`;
answersList.appendChild(answerItem);
});
}
// Restart the game
function restartGame() {
initGame();
}
// Don't auto-initialize the game - wait for modal to close
document.addEventListener('DOMContentLoaded', function() {
// Create animated background
createAnimatedBackground();
});
feather.replace();
</script>
</body>
</html>