A beautiful, interactive weather application with a windowed interface. Built with vanilla JavaScript, HTML, and CSS, featuring draggable/resizable windows, animated elements, and multiple ways to explore weather around the world.
π Live Demo: https://isabeansweatherapp.netlify.app/
π¦ Repository: git clone https://github.com/beanbean9339/WeatherApp.git
- Draggable Windows: All components live in moveable windows that can be dragged anywhere
- 8-Direction Resizing: Resize windows from any edge or corner (N, S, E, W, NE, NW, SE, SW)
- Window Controls: Minimize, maximize, and close buttons for each window
- Z-Index Management: Click any window to bring it to the front
- Window Manager: Toggle visibility of any window using the menu (β°)
- Taskbar: Minimized windows appear in the taskbar for easy restoration
- Quick access grid of 12 major cities worldwide
- One-click weather lookup for: Tokyo, New York, London, Paris, Dubai, Sydney, Mumbai, Moscow, Rio, Singapore, Toronto, and Cairo
- Instantly updates all connected windows (clock, map, weather dashboard)
- Discover random cities based on weather conditions:
- π§οΈ Rainy
- βοΈ Snowy
- βοΈ Clear
- βοΈ Cloudy
- βοΈ Stormy
- π«οΈ Foggy
- Searches through 100+ cities worldwide to find your desired weather
- Current weather conditions with animated icons
- Temperature display with Β°C/Β°F toggle
- Detailed weather information:
- Feels like temperature
- Humidity percentage
- Wind speed
- Weather description
- 24-Hour Forecast: Scrollable hourly forecast with icons and temperatures
- Click anywhere on the map to explore weather at that location
- Draggable pin (π) for precise location selection
- Zoom controls: Zoom in, zoom out, reset
- Displays current zoom level
- Equirectangular projection for accurate coordinate mapping
- Shows weather and forecast for any clicked location
- Beautiful animated flip-clock display
- Shows local time for any explored location
- Automatically updates when you search for a new city
- Displays AM/PM and current date
- Smooth flip animations
- One-click weather for your current GPS coordinates
- Uses browser geolocation API
- Automatically updates weather dashboard with your location
- Dynamic Weather Animations:
- Rain drops for rainy weather
- Snowflakes for snowy conditions
- Smooth Transitions: All elements feature smooth animations
- Warm Color Palette: Designed with a cozy brown and gold theme
- Welcome Screen: Beautiful onboarding modal with feature overview
- Responsive Design: Works on various screen sizes
- Toggle between Celsius (Β°C) and Fahrenheit (Β°F)
- Instant conversion of all displayed temperatures
- Preference persists across all windows
- Modern web browser
- Internet connection
Simply open index.html in your web browser. No build process or dependencies required!
The application uses the OpenWeatherMap API. The current API key in the code is:
const apiKey = 'ae742a983d97f4208e6e659ba7fda017';For production use, you should:
- Sign up for a free API key at OpenWeatherMap
- Replace the API key in script.js
- A welcome modal will appear explaining all features
- Click "Get Started β" to begin
Method 1: Popular Destinations
- Click any city card in the "Popular Destinations" window
Method 2: Search by City
- Type a city name in the "Weather Dashboard" search box
- Click "Search" or press Enter
Method 3: Weather Finder
- Click a weather condition button (e.g., "Rainy")
- The app searches for a random city with that weather
Method 4: Interactive Map
- Click anywhere on the world map
- Or drag the π pin to a location
Method 5: Current Location
- Click "Get My Location" button
- Allow browser location access when prompted
- Move: Click and drag the window header
- Resize: Drag any edge or corner
- Minimize: Click the "β" button
- Maximize: Click the "βΆ" button
- Close: Click the "Γ" button
- Toggle Visibility: Click the β° menu and use checkboxes
WeatherApp-1/
β
βββ index.html # Main HTML structure
βββ script.js # Application logic (1346 lines)
βββ style.css # Styling and animations (2362 lines)
βββ favicon.svg # Weather icon favicon
βββ README.md # This file
- Welcome screen modal
- Window structure for all components:
- How It Works (directions)
- Popular Destinations
- Weather Finder
- Local Time Clock
- My Location
- Weather Dashboard
- Interactive Map
- Taskbar for minimized windows
- Window launcher menu
Core Functions:
getWeather()- Fetch weather for city namegetWeatherByCoordinates(lat, lon)- Fetch weather by coordinatesgetCityWeather(cityName)- Quick city lookupgetMyLocation()- Get user's GPS locationfindWeatherByCondition(condition)- Find random city with specific weather
Display Functions:
displayWeather(data)- Render current weatherdisplayHourlyForecast(data)- Render 24-hour forecastupdateClock(timezone)- Update flip clock animation
UI Functions:
toggleTemperature(unit)- Switch Β°C/Β°FtoggleFullscreen(windowId)- Toggle fullscreen modeminimizeWindow(windowId)- Minimize to taskbarbringWindowToFront(windowId)- Z-index management
Map Functions:
initializeMap()- Set up interactive mapupdateMapPin(lat, lon)- Position pin on map- Zoom controls and panning
Key Styling:
- Window system (draggable, resizable)
- Warm color palette (#3d2c29, #4a3530, #f2cc8f, #f4a259)
- Flip clock animations
- Weather card animations
- Rain and snow particle effects
- Responsive layouts
- Hover effects and transitions
- Primary Background:
#3d2c29(warm brown) - Secondary Background:
#4a3530(darker brown) - Accent Gold:
#f2cc8f - Bright Orange:
#f4a259 - Text: Light colors (#f2cc8f, #e0e0e0)
- Primary Font: 'Varela Round' (headers and UI)
- Secondary Font: 'Quicksand' (body text)
- Weights: 400, 500, 600, 700
- Smooth animations (0.3s transitions)
- Clear visual feedback (hover states, active states)
- Intuitive window management
- Consistent spacing and padding
- Responsive to user actions
The app makes requests to three endpoints:
- Current Weather by City:
https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${apiKey}- Current Weather by Coordinates:
https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lon}&appid=${apiKey}- 5-Day Forecast (used for hourly):
https://api.openweathermap.org/data/2.5/forecast?q=${city}&appid=${apiKey}Weather icons are loaded from OpenWeatherMap:
https://openweathermap.org/img/wn/${iconCode}@4x.png- Implemented with mouse event listeners
- Click and hold window header to drag
- Snap prevention and boundary checking
- Resize handles on all sides and corners
- Maintains minimum width/height (250px Γ 200px)
- Smooth cursor changes for visual feedback
- Custom CSS animations for flip effect
- Updates every second
- Timezone-aware using UTC offset from API
- Rain drops generated dynamically
- Snowflakes with CSS animations
- Triggered based on current weather conditions
- Equirectangular projection calculations
- Zoom with transform scaling
- Pan functionality when zoomed
- Pin dragging with coordinate updates
- API Rate Limits: Free tier OpenWeatherMap has rate limits (60 calls/minute)
- Browser Compatibility: Requires modern browser with ES6 support
- Geolocation: Requires HTTPS in production for geolocation API
- Map Image: Uses external image from Wikipedia (requires internet)
- Add weather alerts and warnings
- Implement weather map overlays (radar, temperature, etc.)
- Save favorite locations
- Add more weather data (UV index, air quality, etc.)
- Implement unit preferences persistence (localStorage)
- Add keyboard shortcuts
- Multi-language support
- Dark/light theme toggle
- Export/share weather reports
- Weather comparison between cities
Edit the CSS variables or color values in style.css:
/* Main colors to modify */
background: linear-gradient(135deg, #3d2c29 0%, #4a3530 100%);
border: 4px solid #f2cc8f;
color: #f2cc8f;Edit the cities array in script.js:
const cities = [
'Tokyo', 'New York', 'London', 'Paris',
// Add your cities here
];Change default CSS positions in style.css:
#world-view {
top: 20px;
left: 20px;
}- β Chrome (recommended)
- β Firefox
- β Safari
- β Edge
- β Internet Explorer (not supported)
- OpenWeatherMap for the weather API
- Google Fonts for Quicksand and Varela Round fonts
- Wikipedia for the world map image