This project visualizes the Fibonacci Spiral using HTML5 Canvas and JavaScript. The spiral is dynamically generated based on user inputs for the scale, number of turns, and line thickness. Additionally, users can save the generated spiral as a PNG image.
- Dynamic Fibonacci Spiral: Generate a Fibonacci spiral with adjustable parameters (scale, turns, thickness).
- Math Visualization: Displays mathematical properties (radius, angle) on the canvas for each segment of the spiral.
- Random Color Mode: The spiral initially renders in a random color, which can be overridden by the user using a color picker.
- Save as PNG: Users can save the generated spiral as a PNG image by clicking the "Save as PNG" button.
- HTML5: Used for creating the structure and layout.
- CSS3: Provides styling for the layout, panels, and controls.
- JavaScript: Handles the canvas drawing, user inputs, random color generation, and saving functionality.
Make sure you have a modern web browser (Chrome, Firefox, Edge, etc.) that supports HTML5 and JavaScript.
-
Clone the repository or download the project files:
git clone https://github.com/your-username/fibonacci-spiral-visualization.git
-
Navigate to the project directory:
cd fibonacci-spiral-visualization
-
Open the
index.html
file in your web browser to run the application:- On Windows: Double-click the
index.html
file. - On macOS/Linux: Right-click and open the file with your browser.
- On Windows: Double-click the
- Adjust the Spiral: Use the controls on the right panel to adjust the scale, number of turns, and line thickness of the Fibonacci spiral.
- Change the Color: Pick a color using the color picker to override the random color.
- Save the Spiral: Click the "Save as PNG" button to download the current visualization as a PNG image.
- Scale: Determines the size of the initial segment.
- Number of Turns: Defines how many segments the spiral should have.
- Line Thickness: Adjusts the thickness of the lines in the spiral.
- Color Picker: Allows users to select a color for the spiral.
- Save as PNG: Downloads the current canvas as an image.
Here's a screenshot of the Fibonacci spiral visualization:
This project is licensed under the MIT License. You can read the full license here.
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature
). - Commit your changes (
git commit -m 'Add your feature'
). - Push to the branch (
git push origin feature/your-feature
). - Open a pull request.
- The Fibonacci sequence and golden ratio for inspiring this project.