Skip to content

falcolnic/galaxy-webgf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Aug 11, 2025
fe49655 · · Aug 11, 2025

History

1 Commit
Aug 11, 2025
Aug 11, 2025
Aug 11, 2025
Aug 11, 2025
Aug 11, 2025
Aug 11, 2025
Aug 11, 2025
Aug 11, 2025

Repository files navigation

# WebGL Animated Spheres Demo

This project visualizes animated spheres in 3D using WebGL. Spheres move under simple physics, leave orbital traces, and can be explored interactively.

## Features

- **3D Spheres**: Multiple spheres rendered with smooth shading.
- **Physics Simulation**: Spheres move and interact with basic gravitational forces.
- **Orbital Traces**: Each sphere leaves a visible trail of its recent path.
- **Interactive Camera**: Rotate the scene by dragging, zoom with the mouse wheel.
- **Grid and Axes**: World grid and colored axes for spatial reference.
- **Axes Overlay**: Small overlay in the corner shows orientation.

## Getting Started

1. Open `index.html` in a WebGL-capable browser.
2. Use your mouse:
   - **Drag** to rotate the camera.
   - **Scroll** to zoom in/out.

## Project Structure

- `index.html` — Main HTML file and canvas.
- `web-gl.js` — WebGL setup, input handling, render loop.
- `draw-scene.js` — Scene rendering logic.
- `init-buffers.js` — Buffer creation for geometry and colors.
- `physics.js` — Sphere state and physics update.
- `shader.js` — GLSL shader code.
- `gl-utils.js` — Utility functions for WebGL.

## Dependencies

- [gl-matrix](# Dependencies

- [gl-matrix](https://glmatrix.net/) (loaded via CDN).

## Customization

- Change sphere parameters in `physics.js`.
- Edit shaders in `shader.js` for different effects.

## License

MIT License (or specify your own).our own).