|
1 | | -# SVG-Shape-Generator |
| 1 | +# 📐 SVG Shape Generator |
| 2 | + |
| 3 | +A versatile web tool for generating various SVG shapes (Polygons, Stars, Circles, Ellipses, Rectangles, Lines) with customizable parameters and live preview. ✨ |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## ✨ Features |
| 8 | + |
| 9 | +* 🎨 **Multiple Shape Types:** Generate: |
| 10 | + * Polygons (Regular) |
| 11 | + * Stars |
| 12 | + * Circles |
| 13 | + * Ellipses |
| 14 | + * Rectangles |
| 15 | + * Rounded Rectangles |
| 16 | + * Lines |
| 17 | +* 🎛️ **Customizable Parameters:** Adjust shape-specific properties: |
| 18 | + * Points/Sides (Polygon, Star) |
| 19 | + * Outer Radius (Polygon, Star) |
| 20 | + * Inner Radius (Star) |
| 21 | + * Radius (Circle) |
| 22 | + * Radius X/Y (Ellipse) |
| 23 | + * Width/Height (Rectangle) |
| 24 | + * Corner Radius RX/RY (Rounded Rectangle) |
| 25 | + * Start/End Coordinates (Line) |
| 26 | + * Center Coordinates (Circle, Ellipse) |
| 27 | + * Top-Left Coordinates (Rectangle) |
| 28 | +* 🎨 **Appearance Controls:** |
| 29 | + * Fill Color (Not applicable for Line) |
| 30 | + * Stroke Color |
| 31 | + * Stroke Width |
| 32 | +* 👁️ **Live Preview:** See the generated SVG shape update instantly as you change parameters. |
| 33 | +* 💻 **Code Generation:** Displays the complete, formatted SVG code for the generated shape. |
| 34 | +* 🖱️ **Click-to-Copy:** Easily copy the generated SVG code. |
| 35 | +* 📱 **Responsive Design:** Basic responsive layout. |
| 36 | +* 💬 **User Feedback:** Displays messages for success (e.g., "SVG code copied!") or errors. |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## 🚀 How to Use |
| 41 | + |
| 42 | +1. Clone this repository or download the `index.html` file. |
| 43 | +2. Open `index.html` in your web browser. |
| 44 | +3. Select the desired **Shape Type** from the dropdown menu. |
| 45 | +4. The relevant controls for the selected shape will appear. |
| 46 | +5. Adjust the sliders and color pickers to customize the shape and its appearance. |
| 47 | +6. The **Preview** area will update in real-time. 🔥 |
| 48 | +7. The **Generated SVG Code** box shows the code for the current shape. |
| 49 | +8. Click the **Copy SVG Code** button to copy the code to your clipboard. 📋 |
| 50 | + |
| 51 | +--- |
| 52 | + |
| 53 | +## 💻 Technology Stack |
| 54 | + |
| 55 | +* **HTML:** Page structure and controls. |
| 56 | +* **CSS (Tailwind CSS):** Styling & layout (via CDN). |
| 57 | +* **JavaScript:** |
| 58 | + * Handles user input from sliders, dropdowns, and color pickers. |
| 59 | + * Calculates shape geometry (points, coordinates, radii). |
| 60 | + * Dynamically generates SVG element strings. |
| 61 | + * Updates the live preview and code output areas. |
| 62 | + * Manages control visibility based on selected shape type. |
| 63 | + * Implements copy-to-clipboard functionality. |
| 64 | + |
| 65 | +--- |
| 66 | + |
| 67 | +## 🤝 Contributing |
| 68 | + |
| 69 | +Contributions are welcome! 🎉 Whether it's bug fixes, adding new shapes, improving the UI, or enhancing features, please feel free to contribute. |
| 70 | + |
| 71 | +**How to Contribute:** |
| 72 | + |
| 73 | +1. **Fork the Repository:** Click the 'Fork' button. |
| 74 | +2. **Clone Your Fork:** |
| 75 | +3. **Create a New Branch:** |
| 76 | + ```bash |
| 77 | + git checkout -b feature/add-path-shape |
| 78 | + # or |
| 79 | + git checkout -b fix/star-calculation-bug |
| 80 | + ``` |
| 81 | +4. **Make Your Changes.** |
| 82 | +5. **Test Your Changes.** |
| 83 | +6. **Commit Your Changes** (Consider [Conventional Commits](https://www.conventionalcommits.org/)): |
| 84 | + ```bash |
| 85 | + git add . |
| 86 | + git commit -m "feat: Add support for SVG <path> element" |
| 87 | + # or |
| 88 | + git commit -m "fix: Correct inner radius calculation for stars" |
| 89 | + ``` |
| 90 | +7. **Push to Your Fork:** |
| 91 | + ```bash |
| 92 | + git push origin feature/add-path-shape |
| 93 | + ``` |
| 94 | +8. **Open a Pull Request (PR):** Go to the original repository and open a PR. |
| 95 | + * Provide a clear title and description. |
| 96 | + * Link any relevant issues. |
| 97 | + |
| 98 | +**Reporting Bugs:** |
| 99 | + |
| 100 | +* Use the GitHub Issues tab. |
| 101 | +* Provide a clear title, description, and steps to reproduce. |
| 102 | + |
| 103 | +**Suggesting Enhancements:** |
| 104 | + |
| 105 | +* Use the GitHub Issues tab. |
| 106 | +* Provide a clear title and detailed description. |
| 107 | + |
| 108 | +--- |
| 109 | + |
| 110 | +## 💡 Potential Enhancements |
| 111 | + |
| 112 | +* **More Shapes:** Add support for `<path>` elements (e.g., arcs, curves), `<text>`, or more complex predefined shapes. |
| 113 | +* **Transformations:** Add controls for `rotate`, `scale`, `skew` transformations. |
| 114 | +* **Gradients/Patterns:** Allow using gradients or patterns for fills/strokes. |
| 115 | +* **ViewBox Control:** Allow users to adjust the SVG `viewBox`. |
| 116 | +* **Export Options:** Add options to download the generated SVG as a `.svg` file. |
| 117 | +* **Code Formatting Options:** Allow choosing different SVG code formatting styles. |
| 118 | +* **UI/UX:** Improve slider precision, add input fields for exact values, enhance visual design. |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +Happy Generating! 📐 |
0 commit comments