A comprehensive, feature-rich weather application with real-time forecasts, advanced astronomical visualizations, historical data analytics, and a beautiful responsive UI. Built with pure JavaScript and modern web technologies.
Live Demo: pimx.pages.dev
- Automatic GPS Detection: Get instant weather data for your current location
- IP-based Fallback: Automatic location detection via IP geolocation if GPS is unavailable
- Advanced City Search: Autocomplete city search with real-time suggestions
- Multi-City Management: Save up to 20 cities and switch between them seamlessly
- Persistent Storage: Cities and preferences saved in browser localStorage
- Real-time Temperature: Current, feels-like, and daily min/max temperatures
- Detailed Weather Stats (13 stat cards with animated progress bars):
- ๐ก๏ธ Feels Like Temperature
- ๐ง Humidity
- ๐จ Wind Speed & Direction
- ๐ฝ Atmospheric Pressure
- ๐๏ธ Visibility
- ๐ฆ Dew Point
- ๐ง๏ธ Precipitation
- โ๏ธ UV Index
- ๐ญ Air Quality Index (AQI)
- ๐ Sunrise Time
- ๐ Sunset Time
- ๐ Moon Phase
- 24-Hour Hourly Forecast: Detailed hour-by-hour predictions with weather icons
- Extended Daily Forecast: Choose between 7 or 14-day forecasts
- Visual Weather Icons: Beautiful animated icons for all weather conditions
- Dynamic Themes: UI automatically adapts to weather conditions (sunny, cloudy, rainy, snowy, night)
- Precipitation History:
- View data for past week, month, 6 months, or year
- Interactive Chart.js line charts
- Statistics: Total precipitation, average max/min, max daily precipitation
- Temperature History:
- Historical temperature trends
- Visual temperature charts
- Beautiful Arc Chart: Real-time visualization of sun's path across the sky using Quadratic Bezier Curves
- Time Markers: Visual markers for 9 AM, 12 PM, 3 PM, and 6 PM
- Color Gradient: Smooth gradient from sunrise to sunset
- Glow Effects: Animated glow effects and pulse animations
- Live Position Tracking: Real-time sun position with altitude angle display
- Detailed Sun Information:
- ๐ Sunrise Time
- ๐ Sunset Time
- โฑ๏ธ Day Length
- ๐ Solar Noon
- ๐ Sun Altitude
- ๐งญ Sun Azimuth
- โฌ๏ธ Maximum Altitude
- ๐ Distance from Sun
- Moon Path Visualization: Beautiful arc chart showing moon's journey across the sky
- Twinkling Stars: Animated stars in the night sky background
- Night Visual Effects: Atmospheric night-time visuals
- Live Moon Tracking: Real-time moon position display
- Detailed Moon Information:
- ๐ Moon Phase (8 phases with graphical display)
- ๐ก Illumination Percentage
- ๐ Moon Age (days since new moon)
- ๐ Moonrise Time
- ๐ Moonset Time
- โฑ๏ธ Duration Above Horizon
- ๐ Moon Altitude
- ๐ Distance from Earth
- Real Astronomical Positions: All 8 planets (Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune) with accurate VSOP87 calculations
- Interactive Time Control:
- Hour slider (00:00 - 23:00) to observe planetary motion throughout the day
- "Now" button to jump to current time
- Real-time position updates
- Zoom Controls: Zoom in/out and reset for better viewing (0.5x to 2.0x)
- Planet Details: Click any planet to see:
- Distance from Sun (AU)
- 3D Coordinates (X, Y, Z)
- Angle and position information
- Visual Features:
- Saturn's rings
- Earth's moon
- Color-coded planet legend
- Accuracy: Positions accurate for any date/time (1800-2200 CE)
- Day Navigation: Click any day in the forecast to see detailed hourly breakdown
- Date Selector: Previous/Next day buttons with live date display
- Live Clock: Real-time local time display for selected city
- Auto-refresh: Weather data updates automatically
- Multi-language Support:
- ๐ซ๐ท Persian (Farsi)
- ๐ฌ๐ง English
- Auto-detection based on browser/geolocation
- Temperature Units: Toggle between Celsius (ยฐC) and Fahrenheit (ยฐF)
- Responsive Zoom: Auto-optimized zoom levels for mobile, tablet, and desktop
- Beautiful Animations:
- Weather-specific animations (sun, clouds, rain, snow, night)
- Loading screen animations
- Smooth transitions and hover effects
- Dynamic Color Themes: UI adapts colors based on weather conditions
- Progress Bar Animations: Animated progress bars for all stat cards
- SVG Graphics: Custom SVG elements for astronomical visualizations
- Mobile-First: Optimized for all screen sizes
- Breakpoint Support:
- Mobile (โค560px)
- Tablet (โค880px)
- Desktop (>880px)
- Touch-Friendly: Optimized touch targets and gestures
- Adaptive Layouts: Grid and Flexbox layouts that adapt to screen size
-
Clone the repository
git clone https://github.com/MOHAMMADREZAABEDINPOOR/PIMX_WEATHER.git cd PIMX_WEATHER -
Open in browser
- Simply open
index.htmlin any modern web browser - No build process or dependencies required!
- Simply open
-
Start using
- Allow location access when prompted (optional)
- Or search for any city worldwide
- Modern Browser: Chrome, Firefox, Safari, Edge (latest versions)
- JavaScript: Must be enabled
- Internet Connection: Required for API calls
This is a pure client-side application:
- โ No server required
- โ No build process
- โ No npm/node dependencies (except CDN libraries)
- โ Works offline for saved cities (after initial load)
- Primary: Open-Meteo - Free, accurate, and reliable weather API
- Forecast API: Real-time and future weather data
- Archive API: Historical weather data
- Air Quality API: Air pollution and AQI data
- Geocoding API: City search and reverse geocoding
- GPS: Native browser geolocation API
- IP Geolocation: ipapi.co - IP-based location detection
- VSOP87: Variations Sรฉculaires des Orbites Planรฉtaires - Planetary position calculations
- Kepler's Equation: Solving for planetary orbits
- Julian Day: Astronomical date/time conversion
- Reference Standards:
- HTML5: Semantic markup and modern HTML features
- CSS3:
- CSS Grid & Flexbox for layouts
- CSS Animations & Transitions
- CSS Variables (Custom Properties)
- Media Queries for responsive design
- Vanilla JavaScript (ES6+):
- Modern ES6+ syntax
- Async/Await for API calls
- LocalStorage for data persistence
- Canvas API for charts
- Chart.js 4.4.0: Interactive charts for historical data
- Vazirmatn Font: Persian/Arabic font support
- Open-Meteo API: Weather data provider
PIMX_WEATHER/
โโโ index.html # Main HTML structure
โโโ styles.css # Main stylesheet
โโโ animations.css # Weather animations
โโโ app.js # Main application logic
โโโ i18n.js # Internationalization (i18n)
โโโ README.md # Documentation
The application uses Quadratic Bezier Curves to accurately represent the sun and moon's paths:
Arc Path: M 20,130 Q 200,20 380,130
- Start point (sunrise): (20, 130)
- Control point (zenith): (200, 20)
- End point (sunset): (380, 130)
t = (current time - sunrise) / (sunset - sunrise) // 0 to 1
x = (1-t)ยฒ ร xโ + 2(1-t)t ร xc + tยฒ ร xโ
y = (1-t)ยฒ ร yโ + 2(1-t)t ร yc + tยฒ ร yโThe solar system uses precision astronomical algorithms:
- Julian Day Number (JD): Converts any date/time to astronomical Julian Day
- VSOP87 Orbital Elements: Calculates planetary orbital parameters
- Semi-major axis (a)
- Eccentricity (e)
- Inclination (I)
- Mean longitude (L)
- Longitude of perihelion (ฯฬ)
- Longitude of ascending node (ฮฉ)
- Kepler's Equation: Solves M = E - eยทsin(E) using Newton-Raphson iteration
- True Anomaly: Calculates actual planet position
- Heliocentric Coordinates: Converts to 3D (X, Y, Z) coordinate system
- โ Valid for years 1800-2200 CE
- โ Position error < 1 degree
- โ Real-time updates
- โ Timezone-aware calculations
- Uses high-precision Julian Day formulas
- Moon age calculated to 0.1 day accuracy
- 8 distinct moon phases with visual representations
- Centralized app state object
- LocalStorage persistence for:
- Saved cities (up to 20)
- Temperature unit preference
- Active city index
- Solar system zoom level
- Lazy Loading: Charts loaded only when needed
- Debounced Search: City search debounced for performance
- Efficient Rendering: Only updates changed DOM elements
- CDN Resources: External libraries loaded from CDN
- Semantic HTML: Proper HTML5 semantic elements
- ARIA Labels: Screen reader support
- Keyboard Navigation: Full keyboard accessibility
- Responsive Text: Scalable font sizes
- Modern Card-Based Layout: Clean, organized sections
- Smooth Animations: Weather-specific animations enhance user experience
- Progress Indicators: Animated progress bars for all metrics
- Loading States: Beautiful loading screen with progress bar
- Toast Notifications: User-friendly notification system
Automatically switches based on weather:
- โ๏ธ Sunny Day: Warm yellows and oranges
- โ๏ธ Cloudy: Soft grays and whites
- ๐ง๏ธ Rainy: Cool blues and grays
- โ๏ธ Snowy: Bright whites and blues
- ๐ Night: Dark blues and purples
| Feature Category | Count | Details |
|---|---|---|
| Weather Metrics | 13 | Comprehensive stat cards |
| Forecast Periods | 2 | 7-day / 14-day options |
| Historical Periods | 4 | Week, Month, 6 Months, Year |
| Astronomy Objects | 11 | Sun, Moon, 8 Planets |
| Languages | 2 | Persian, English |
| Temperature Units | 2 | Celsius, Fahrenheit |
| Saved Cities | 20 | Maximum storage |
| Chart Types | 2 | Precipitation, Temperature |
Location not detected
- Check browser permissions for location access
- Try using IP-based location fallback
- Manually search for your city
Weather data not loading
- Check internet connection
- Verify API endpoints are accessible
- Check browser console for errors
Sun/Moon position incorrect
- Ensure device timezone is correct
- Refresh the page
- Check console logs for debug information
Charts not displaying
- Ensure Chart.js library loaded correctly
- Check browser console for errors
- Try refreshing the page
Potential features for future versions:
- ๐ Weather maps integration
- ๐ฑ Progressive Web App (PWA) support
- ๐ Weather alerts and notifications
- ๐ More detailed climate data
- ๐ Additional language support
- ๐จ More theme customization options
This project is released under the MIT License. Feel free to use, modify, and distribute as needed.
Mohammadreza Abedinpour
- ๐ Website: pimx.pages.dev
- ๐ป GitHub: @MOHAMMADREZAABEDINPOOR
Contributions are welcome! If you find a bug or have a feature suggestion:
- Open an Issue: Describe the problem or feature request
- Fork the Repository: Create your own fork
- Create a Branch: Work on your changes
- Submit a Pull Request: Share your improvements
For bug reports, please include:
- Browser and version
- Operating system
- Steps to reproduce
- Expected vs actual behavior
- Open-Meteo for free weather API
- Chart.js for beautiful charts
- JPL Horizons for astronomical reference
- Jean Meeus for astronomical algorithms reference
- All contributors and users
Made with โค๏ธ and โ by Mohammadreza Abedinpour
Last updated: 2025