Skip to content

yhattav/react-gravity

Folders and files

NameName
Last commit message
Last commit date
Dec 19, 2024
Nov 23, 2024
Jan 7, 2025
Dec 29, 2024
Dec 19, 2024
Jan 18, 2025
Dec 19, 2024
Dec 19, 2024
Nov 23, 2024
Dec 19, 2024
Dec 19, 2024
Nov 16, 2024
Jan 7, 2025
Nov 23, 2024
Dec 29, 2024
Nov 27, 2024
Jan 16, 2025
Jan 16, 2025
Dec 19, 2024
Nov 15, 2024
Nov 15, 2024
Nov 15, 2024
Dec 29, 2024
Dec 19, 2024

Repository files navigation

React Gravity Simulator

An interactive gravity simulation built with React, TypeScript, and Vite. This project demonstrates particle physics interactions with gravitational forces in a web browser.

React Gravity Simulator Preview

Live Demo

React Gravity Simulator

React Gravity Simulator Icon

Features

  • Real-time gravity simulation
  • Interactive particle creation
  • Customizable gravity points with different masses
  • Draggable gravity sources
  • Debug visualization of forces and velocities
  • Configurable physics parameters
  • Particle trails
  • Fullscreen mode

Tech Stack

  • React 18
  • TypeScript
  • Vite
  • Ant Design
  • Framer Motion
  • Custom Physics Engine
  • Paper.js

Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/react-gravity.git
cd react-gravity
  1. Install dependencies:
npm install
# or
yarn
  1. Start the development server:
npm run dev
# or
yarn dev
  1. Open your browser and navigate to http://localhost:5173

Usage

  • Click anywhere on the screen to create particles
  • Drag the gravity points to influence particle movement
  • Use the settings panel to adjust physics parameters
  • Toggle debug visualizations for forces and velocities
  • Use the star palette to create new gravity points

Building for Production

npm run build
# or
yarn build

The built files will be in the dist directory.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A 2d gravity engine served with react

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published