Skip to content

Commit

Permalink
initial readme and mit (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
yhattav authored Nov 16, 2024
1 parent ed0edcf commit 7995fac
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 40 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Yonatan Hattav

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
113 changes: 73 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,83 @@
# React + TypeScript + Vite
# React Gravity Simulator

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
An interactive gravity simulation built with React, TypeScript, and Vite. This project demonstrates particle physics interactions with gravitational forces in a web browser.

Currently, two official plugins are available:
## Features

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
- 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

## Expanding the ESLint configuration
## Tech Stack

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- React 18
- TypeScript
- Vite
- Ant Design
- Framer Motion
- Custom Physics Engine

- Configure the top-level `parserOptions` property like this:
## Getting Started

```js
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
### Prerequisites

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

### Installation

1. Clone the repository:

```bash
git clone https://github.com/yourusername/react-gravity.git
cd react-gravity
```

2. Install dependencies:

```bash
npm install
# or
yarn
```

- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
- Optionally add `...tseslint.configs.stylisticTypeChecked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:

```js
// eslint.config.js
import react from 'eslint-plugin-react'

export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
})
3. Start the development server:

```bash
npm run dev
# or
yarn dev
```

4. 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

```bash
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](LICENSE) file for details.

0 comments on commit 7995fac

Please sign in to comment.