Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
# hello-world
# Random Pokémon Generator

A simple web app that displays a random Pokémon from the original 151 Pokémon (Generation 1).

## Features

- Displays a random Pokémon with its Pokédex number
- Beautiful gradient design with smooth animations
- Responsive layout that works on mobile and desktop
- Click the button to generate a new random Pokémon

## How to Use

1. Open `index.html` in your web browser
2. Click the "Generate Random Pokémon" button to see a random Pokémon
3. A random Pokémon will also be displayed when the page first loads

## Files

- `index.html` - Main HTML structure
- `style.css` - Styling and animations
- `script.js` - JavaScript logic with all 151 Pokémon

## Pokémon Included

All original 151 Pokémon from Generation 1 (Bulbasaur to Mew)
36 changes: 36 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random Pokémon Generator</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>Random Pokémon Generator</h1>
<p class="subtitle">Original 151 Pokémon</p>

<div class="wheel-container">
<div id="pokemon-wheel" class="pokemon-wheel">
<div class="wheel-inner">
<div class="pokeball"></div>
</div>
</div>
</div>

<div id="pokemon-display" class="pokemon-card">
<div class="pokemon-number" id="pokemon-number">???</div>
<div class="pokemon-name" id="pokemon-name">Spin the wheel!</div>
</div>

<button id="generate-btn" class="generate-btn">Spin the Wheel!</button>

<div class="stats">
<p>Total Pokémon: <span id="total-count">151</span></p>
</div>
</div>

<script src="script.js"></script>
</body>
</html>
201 changes: 201 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
// Array of all original 151 Pokémon
const pokemon = [
"Bulbasaur",
"Ivysaur",
"Venusaur",
"Charmander",
"Charmeleon",
"Charizard",
"Squirtle",
"Wartortle",
"Blastoise",
"Caterpie",
"Metapod",
"Butterfree",
"Weedle",
"Kakuna",
"Beedrill",
"Pidgey",
"Pidgeotto",
"Pidgeot",
"Rattata",
"Raticate",
"Spearow",
"Fearow",
"Ekans",
"Arbok",
"Pikachu",
"Raichu",
"Sandshrew",
"Sandslash",
"Nidoran♀",
"Nidorina",
"Nidoqueen",
"Nidoran♂",
"Nidorino",
"Nidoking",
"Clefairy",
"Clefable",
"Vulpix",
"Ninetales",
"Jigglypuff",
"Wigglytuff",
"Zubat",
"Golbat",
"Oddish",
"Gloom",
"Vileplume",
"Paras",
"Parasect",
"Venonat",
"Venomoth",
"Diglett",
"Dugtrio",
"Meowth",
"Persian",
"Psyduck",
"Golduck",
"Mankey",
"Primeape",
"Growlithe",
"Arcanine",
"Poliwag",
"Poliwhirl",
"Poliwrath",
"Abra",
"Kadabra",
"Alakazam",
"Machop",
"Machoke",
"Machamp",
"Bellsprout",
"Weepinbell",
"Victreebel",
"Tentacool",
"Tentacruel",
"Geodude",
"Graveler",
"Golem",
"Ponyta",
"Rapidash",
"Slowpoke",
"Slowbro",
"Magnemite",
"Magneton",
"Farfetch'd",
"Doduo",
"Dodrio",
"Seel",
"Dewgong",
"Grimer",
"Muk",
"Shellder",
"Cloyster",
"Gastly",
"Haunter",
"Gengar",
"Onix",
"Drowzee",
"Hypno",
"Krabby",
"Kingler",
"Voltorb",
"Electrode",
"Exeggcute",
"Exeggutor",
"Cubone",
"Marowak",
"Hitmonlee",
"Hitmonchan",
"Lickitung",
"Koffing",
"Weezing",
"Rhyhorn",
"Rhydon",
"Chansey",
"Tangela",
"Kangaskhan",
"Horsea",
"Seadra",
"Goldeen",
"Seaking",
"Staryu",
"Starmie",
"Mr. Mime",
"Scyther",
"Jynx",
"Electabuzz",
"Magmar",
"Pinsir",
"Tauros",
"Magikarp",
"Gyarados",
"Lapras",
"Ditto",
"Eevee",
"Vaporeon",
"Jolteon",
"Flareon",
"Porygon",
"Omanyte",
"Omastar",
"Kabuto",
"Kabutops",
"Aerodactyl",
"Snorlax",
"Articuno",
"Zapdos",
"Moltres",
"Dratini",
"Dragonair",
"Dragonite",
"Mewtwo",
"Mew"
];

// Get DOM elements
const generateBtn = document.getElementById('generate-btn');
const pokemonNameEl = document.getElementById('pokemon-name');
const pokemonNumberEl = document.getElementById('pokemon-number');
const pokemonWheel = document.getElementById('pokemon-wheel');

let isSpinning = false;

// Function to spin the wheel and generate random Pokémon
function spinWheel() {
if (isSpinning) return;

isSpinning = true;
generateBtn.disabled = true;

// Add spinning class to wheel
pokemonWheel.classList.add('spinning');

// Generate random Pokémon
const randomIndex = Math.floor(Math.random() * pokemon.length);
const randomPokemon = pokemon[randomIndex];
const pokemonNumber = randomIndex + 1; // Pokédex number (1-indexed)

// Wait for spin animation to complete (2 seconds)
setTimeout(() => {
// Remove spinning class
pokemonWheel.classList.remove('spinning');

// Show the result with animation
const card = document.getElementById('pokemon-display');
card.style.transform = 'scale(0.95)';

setTimeout(() => {
pokemonNameEl.textContent = randomPokemon;
pokemonNumberEl.textContent = `#${pokemonNumber.toString().padStart(3, '0')}`;
card.style.transform = 'scale(1)';

// Re-enable button
isSpinning = false;
generateBtn.disabled = false;
}, 200);
}, 2000);
}

// Event listener for button click
generateBtn.addEventListener('click', spinWheel);
Loading