From f2d45f3e13f094c8587afabef63d19c7c58b4662 Mon Sep 17 00:00:00 2001
From: sanskar srivastava <112918830+dhawalcoder42@users.noreply.github.com>
Date: Fri, 19 Jul 2024 21:52:07 +0530
Subject: [PATCH 01/17] 70% of work done
made a side bar where options are there to select shape , add custom colours and download svg shape design . also added shape previewer where we can see and edit shapes and can drag them.
---
package.json | 2 +-
.../(tools)/svg-shape-generator/+page.svelte | 187 ++++++++++++++-
.../(tools)/svg-shape-generator/meta.json | 6 +-
src/routes/tools.json | 216 ++++++++++++++++++
4 files changed, 397 insertions(+), 14 deletions(-)
diff --git a/package.json b/package.json
index 24d9001e6..c637234af 100644
--- a/package.json
+++ b/package.json
@@ -25,7 +25,6 @@
},
"dependencies": {
"@faker-js/faker": "^8.4.1",
- "@sveltejs/adapter-node": "^1.3.1",
"axios": "^1.7.2",
"cheerio": "^1.0.0-rc.12",
"cors": "^2.8.5",
@@ -35,6 +34,7 @@
"jspdf": "^2.5.1",
"pdf-lib": "^1.17.1",
"svelte-awesome-color-picker": "^3.1.0",
+ "svelte-svg": "^0.0.7",
"svelte-tags-input": "^6.0.0",
"tailwindcss": "^3.3.5",
"tesseract.js": "^5.0.2",
diff --git a/src/routes/(tools)/svg-shape-generator/+page.svelte b/src/routes/(tools)/svg-shape-generator/+page.svelte
index 55b5a5ecf..ea92cd8ed 100644
--- a/src/routes/(tools)/svg-shape-generator/+page.svelte
+++ b/src/routes/(tools)/svg-shape-generator/+page.svelte
@@ -1,11 +1,178 @@
-
-
-
-
-
-
\ No newline at end of file
+ import { writable } from 'svelte/store';
+
+ let color = '#FF0066';
+ let svgShape = 'M150 0 L75 200 L225 200 Z';
+ const shapes = writable([]);
+
+ let dragState = {
+ isDragging: false,
+ isResizing: false,
+ startX: 0,
+ startY: 0,
+ shapeIndex: null
+ };
+
+ function addShape() {
+ shapes.update(items => [
+ ...items,
+ { id: items.length, path: svgShape, color, x: 0, y: 0, width: 100, height: 100 }
+ ]);
+ }
+
+ function downloadSVG() {
+ const svgContent = `
+
+ `;
+ const blob = new Blob([svgContent], { type: 'image/svg+xml' });
+ const url = URL.createObjectURL(blob);
+ const a = document.createElement('a');
+ a.href = url;
+ a.download = 'shape.svg';
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ URL.revokeObjectURL(url);
+ }
+
+ function startDrag(event, index) {
+ dragState.isDragging = true;
+ dragState.startX = event.clientX;
+ dragState.startY = event.clientY;
+ dragState.shapeIndex = index;
+ }
+
+ function startResize(event, index) {
+ dragState.isResizing = true;
+ dragState.startX = event.clientX;
+ dragState.startY = event.clientY;
+ dragState.shapeIndex = index;
+ }
+
+ function onMouseMove(event) {
+ if (dragState.isDragging && dragState.shapeIndex !== null) {
+ const dx = event.clientX - dragState.startX;
+ const dy = event.clientY - dragState.startY;
+ shapes.update(items => {
+ const updatedItems = [...items];
+ const shape = updatedItems[dragState.shapeIndex];
+ shape.x += dx;
+ shape.y += dy;
+ dragState.startX = event.clientX;
+ dragState.startY = event.clientY;
+ return updatedItems;
+ });
+ } else if (dragState.isResizing && dragState.shapeIndex !== null) {
+ const dx = event.clientX - dragState.startX;
+ const dy = event.clientY - dragState.startY;
+ shapes.update(items => {
+ const updatedItems = [...items];
+ const shape = updatedItems[dragState.shapeIndex];
+ shape.width += dx;
+ shape.height += dy;
+ dragState.startX = event.clientX;
+ dragState.startY = event.clientY;
+ return updatedItems;
+ });
+ }
+ }
+
+ function onMouseUp() {
+ dragState.isDragging = false;
+ dragState.isResizing = false;
+ dragState.shapeIndex = null;
+ }
+
+
+ window.addEventListener('mousemove', onMouseMove);
+ window.addEventListener('mouseup', onMouseUp);
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/routes/(tools)/svg-shape-generator/meta.json b/src/routes/(tools)/svg-shape-generator/meta.json
index cea5af16b..74085fc3b 100644
--- a/src/routes/(tools)/svg-shape-generator/meta.json
+++ b/src/routes/(tools)/svg-shape-generator/meta.json
@@ -1,9 +1,9 @@
{
"name": "SVG Shape Generator ",
- "description":"",
+ "description":"The SVG Shape Generator is a user-friendly web application designed to create and customize SVG shapes. Users can select from various predefined shapes, adjust their colors, and manipulate them through dragging and resizing. The tool supports adding multiple shapes, allowing for complex designs. Once satisfied, users can download the final SVG file, making it an ideal solution for graphic designers and web developers looking to create scalable vector graphics efficiently. ",
"contributors": [{
- "name": "",
- "githubId": ""
+ "name": "Sanskar Srivastava",
+ "githubId": "https://github.com/dhawalcoder42"
}, {
"name": "",
"githubId": ""
diff --git a/src/routes/tools.json b/src/routes/tools.json
index 4618b3690..796472b09 100644
--- a/src/routes/tools.json
+++ b/src/routes/tools.json
@@ -134,6 +134,33 @@
}
]
},
+ "camera-recorder-2": {
+ "name": "Camera Recorder 2",
+ "link": "/camera-recorder-2",
+ "description": "",
+ "contributors": [
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ }
+ ]
+ },
"code-comparison-tool": {
"name": "Code Comparison Tool",
"link": "/code-comparison-tool",
@@ -161,6 +188,33 @@
}
]
},
+ "color-blindness-simulator": {
+ "name": "Color Blindness Simulator",
+ "link": "/color-blindness-simulator",
+ "description": "",
+ "contributors": [
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ }
+ ]
+ },
"css-animator": {
"name": "CSS Animator",
"link": "/css-animator",
@@ -442,6 +496,60 @@
}
]
},
+ "integer-toolkit": {
+ "name": "Integer Toolkit",
+ "link": "/integer-toolkit",
+ "description": "",
+ "contributors": [
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ }
+ ]
+ },
+ "integer-toolkit-2": {
+ "name": "Integer Toolkit",
+ "link": "/integer-toolkit-2",
+ "description": "",
+ "contributors": [
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ }
+ ]
+ },
"keyword-density-checker": {
"name": "Keyword Density Checker",
"link": "/keyword-density-checker",
@@ -469,6 +577,33 @@
}
]
},
+ "list-toolkit": {
+ "name": "List Toolkit",
+ "link": "/list-toolkit",
+ "description": "",
+ "contributors": [
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ }
+ ]
+ },
"living-background-generator": {
"name": "Living Background Generator",
"link": "/living-background-generator",
@@ -696,6 +831,60 @@
}
]
},
+ "svg-placeholder-generator": {
+ "name": "SVG Placeholder Generator",
+ "link": "/svg-placeholder-generator",
+ "description": "",
+ "contributors": [
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ }
+ ]
+ },
+ "svg-shape-generator": {
+ "name": "SVG Shape Generator ",
+ "link": "/svg-shape-generator",
+ "description": "The SVG Shape Generator is a user-friendly web application designed to create and customize SVG shapes. Users can select from various predefined shapes, adjust their colors, and manipulate them through dragging and resizing. The tool supports adding multiple shapes, allowing for complex designs. Once satisfied, users can download the final SVG file, making it an ideal solution for graphic designers and web developers looking to create scalable vector graphics efficiently. ",
+ "contributors": [
+ {
+ "name": "Sanskar Srivastava",
+ "githubId": "https://github.com/dhawalcoder42"
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ }
+ ]
+ },
"text-toolkit": {
"name": "Text Toolkit",
"link": "/text-toolkit",
@@ -820,5 +1009,32 @@
"githubId": ""
}
]
+ },
+ "youtube-thumbnail-grabber": {
+ "name": "YouTube Thumbnail Grabber",
+ "link": "/youtube-thumbnail-grabber",
+ "description": "",
+ "contributors": [
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ }
+ ]
}
}
\ No newline at end of file
From 265eaf3e8d0a73b4b5485e4c736435e0b80ddf13 Mon Sep 17 00:00:00 2001
From: Ayush202201070127 <139002736+Ayush202201070127@users.noreply.github.com>
Date: Sat, 20 Jul 2024 10:26:15 +0530
Subject: [PATCH 02/17] Delete & Resize Feature
Delete and Shape Resize feature are added.
---
+page.svelte | 229 +++++++++++++++++++++++++++++++++++++++++++++++++++
meta.json | 23 ++++++
2 files changed, 252 insertions(+)
create mode 100644 +page.svelte
create mode 100644 meta.json
diff --git a/+page.svelte b/+page.svelte
new file mode 100644
index 000000000..8c932834f
--- /dev/null
+++ b/+page.svelte
@@ -0,0 +1,229 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/meta.json b/meta.json
new file mode 100644
index 000000000..74085fc3b
--- /dev/null
+++ b/meta.json
@@ -0,0 +1,23 @@
+{
+ "name": "SVG Shape Generator ",
+ "description":"The SVG Shape Generator is a user-friendly web application designed to create and customize SVG shapes. Users can select from various predefined shapes, adjust their colors, and manipulate them through dragging and resizing. The tool supports adding multiple shapes, allowing for complex designs. Once satisfied, users can download the final SVG file, making it an ideal solution for graphic designers and web developers looking to create scalable vector graphics efficiently. ",
+ "contributors": [{
+ "name": "Sanskar Srivastava",
+ "githubId": "https://github.com/dhawalcoder42"
+ }, {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ }]
+}
\ No newline at end of file
From fbf444456cfaef4c65b84fbdb1750861573e3ca8 Mon Sep 17 00:00:00 2001
From: Ayush202201070127 <139002736+Ayush202201070127@users.noreply.github.com>
Date: Sat, 20 Jul 2024 13:32:56 +0530
Subject: [PATCH 03/17] Scroll Bar Resizing Updated
Options + & - where updated to scroll bar for resizing.
---
+page.svelte | 45 +++++++++++++++++++--------------------------
meta.json | 44 ++++++++++++++++++++++----------------------
2 files changed, 41 insertions(+), 48 deletions(-)
diff --git a/+page.svelte b/+page.svelte
index 8c932834f..994e5566b 100644
--- a/+page.svelte
+++ b/+page.svelte
@@ -4,6 +4,8 @@
let color = '#FF0066';
let svgShape = 'M150 0 L75 200 L225 200 Z';
const shapes = writable([]);
+ let selectedShapeIndex = null;
+ let size = 100; // Default size
let dragState = {
isDragging: false,
@@ -16,7 +18,7 @@
function addShape() {
shapes.update(items => [
...items,
- { id: items.length, path: svgShape, color, x: 0, y: 0, width: 100, height: 100 }
+ { id: items.length, path: svgShape, color, x: 0, y: 0, width: size, height: size }
]);
}
@@ -24,30 +26,17 @@
shapes.update(items => items.slice(0, -1));
}
- function increaseSize() {
- shapes.update(items => {
- if (items.length > 0) {
- const updatedItems = [...items];
- const shape = updatedItems[updatedItems.length - 1];
- shape.width += 10;
- shape.height += 10;
- return updatedItems;
- }
- return items;
- });
- }
-
- function decreaseSize() {
- shapes.update(items => {
- if (items.length > 0) {
+ function onSizeChange(event) {
+ const newSize = Number(event.target.value);
+ if (selectedShapeIndex !== null) {
+ shapes.update(items => {
const updatedItems = [...items];
- const shape = updatedItems[updatedItems.length - 1];
- shape.width = Math.max(10, shape.width - 10);
- shape.height = Math.max(10, shape.height - 10);
+ const shape = updatedItems[selectedShapeIndex];
+ shape.width = newSize;
+ shape.height = newSize;
return updatedItems;
- }
- return items;
- });
+ });
+ }
}
function downloadSVG() {
@@ -72,6 +61,8 @@
dragState.startX = event.clientX;
dragState.startY = event.clientY;
dragState.shapeIndex = index;
+ selectedShapeIndex = index;
+ size = $shapes[index].width; // Set initial size for the selected shape
}
function startResize(event, index) {
@@ -144,7 +135,7 @@
}
.resize-toolbar {
display: flex;
- justify-content: space-between;
+ flex-direction: column;
gap: 10px;
}
.resize-title {
@@ -184,6 +175,9 @@
flex: 1;
padding: 10px;
}
+ .range-input {
+ width: 100%;
+ }
@@ -209,8 +203,7 @@
Resize Shape
-
-
+
diff --git a/meta.json b/meta.json
index 74085fc3b..d85c6166e 100644
--- a/meta.json
+++ b/meta.json
@@ -1,23 +1,23 @@
-{
- "name": "SVG Shape Generator ",
- "description":"The SVG Shape Generator is a user-friendly web application designed to create and customize SVG shapes. Users can select from various predefined shapes, adjust their colors, and manipulate them through dragging and resizing. The tool supports adding multiple shapes, allowing for complex designs. Once satisfied, users can download the final SVG file, making it an ideal solution for graphic designers and web developers looking to create scalable vector graphics efficiently. ",
- "contributors": [{
- "name": "Sanskar Srivastava",
- "githubId": "https://github.com/dhawalcoder42"
- }, {
- "name": "",
- "githubId": ""
- },
- {
- "name": "",
- "githubId": ""
- },
- {
- "name": "",
- "githubId": ""
- },
- {
- "name": "",
- "githubId": ""
- }]
+{
+ "name": "SVG Shape Generator ",
+ "description":"The SVG Shape Generator is a user-friendly web application designed to create and customize SVG shapes. Users can select from various predefined shapes, adjust their colors, and manipulate them through dragging and resizing. The tool supports adding multiple shapes, allowing for complex designs. Once satisfied, users can download the final SVG file, making it an ideal solution for graphic designers and web developers looking to create scalable vector graphics efficiently. ",
+ "contributors": [{
+ "name": "Sanskar Srivastava",
+ "githubId": "https://github.com/dhawalcoder42"
+ }, {
+ "name": "Ayush Fating",
+ "githubId": "https://github.com/Ayush202201070127"
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ },
+ {
+ "name": "",
+ "githubId": ""
+ }]
}
\ No newline at end of file
From 23eec13b2680df932005affb3d6853bf4fed5283 Mon Sep 17 00:00:00 2001
From: Ayush202201070127 <139002736+Ayush202201070127@users.noreply.github.com>
Date: Mon, 22 Jul 2024 18:19:20 +0530
Subject: [PATCH 04/17] UI & Shapes Updated
New UI & Shapes are added to make it more interactive.
---
+page.svelte | 290 +++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 259 insertions(+), 31 deletions(-)
diff --git a/+page.svelte b/+page.svelte
index 994e5566b..ad68a2377 100644
--- a/+page.svelte
+++ b/+page.svelte
@@ -2,10 +2,11 @@
import { writable } from 'svelte/store';
let color = '#FF0066';
- let svgShape = 'M150 0 L75 200 L225 200 Z';
+ let svgShape = 'M150 0 L75 200 L225 200 Z'; // Default shape
const shapes = writable([]);
let selectedShapeIndex = null;
let size = 100; // Default size
+ let showDownloadOptions = false; // State for download options visibility
let dragState = {
isDragging: false,
@@ -15,10 +16,93 @@
shapeIndex: null
};
+ function randomPoints(count, width, height) {
+ const points = [];
+ for (let i = 0; i < count; i++) {
+ const x = Math.random() * width;
+ const y = Math.random() * height;
+ points.push({ x, y });
+ }
+ return points;
+ }
+
+ function generateRandomPath(points) {
+ if (points.length < 2) return ''; // Not enough points to create a path
+
+ let path = `M${points[0].x},${points[0].y} `;
+ for (let i = 1; i < points.length; i++) {
+ path += `L${points[i].x},${points[i].y} `;
+ }
+ path += 'Z'; // Close the path
+ return path;
+ }
+
+ function randomShape() {
+ const pointCount = Math.floor(Math.random() * 5) + 3; // Between 3 and 7 points
+ const points = randomPoints(pointCount, 500, 500); // Assuming a canvas size of 500x500
+ return generateRandomPath(points);
+ }
+
+ function generateBlobPath() {
+ const numPoints = 8; // Number of points around the blob
+ const radius = 100; // Radius of the blob
+ const variance = 40; // How much to vary the points from the radius
+
+ const points = [];
+ for (let i = 0; i < numPoints; i++) {
+ const angle = (i / numPoints) * (2 * Math.PI);
+ const distance = radius + (Math.random() - 0.5) * variance;
+ const x = 250 + Math.cos(angle) * distance;
+ const y = 250 + Math.sin(angle) * distance;
+ points.push({ x, y });
+ }
+
+ return generateCatmullRomPath(points);
+ }
+
+ function generateCatmullRomPath(points) {
+ if (points.length < 2) return ''; // Not enough points to create a path
+
+ const path = [];
+ path.push(`M${points[0].x},${points[0].y}`);
+
+ for (let i = 0; i < points.length; i++) {
+ const p0 = points[i];
+ const p1 = points[(i + 1) % points.length];
+ const p2 = points[(i + 2) % points.length];
+ const p3 = points[(i + 3) % points.length];
+
+ for (let t = 0; t <= 1; t += 0.1) {
+ const x = 0.5 * (
+ (-p0.x + 3 * p1.x - 3 * p2.x + p3.x) * t * t * t +
+ (2 * p0.x - 5 * p1.x + 4 * p2.x - p3.x) * t * t +
+ (-p0.x + p2.x) * t +
+ 2 * p1.x
+ );
+
+ const y = 0.5 * (
+ (-p0.y + 3 * p1.y - 3 * p2.y + p3.y) * t * t * t +
+ (2 * p0.y - 5 * p1.y + 4 * p2.y - p3.y) * t * t +
+ (-p0.y + p2.y) * t +
+ 2 * p1.y
+ );
+
+ path.push(`L${x},${y}`);
+ }
+ }
+
+ path.push('Z'); // Ensure the path is closed
+ return path.join(' ');
+ }
+
function addShape() {
+ const shapeToAdd = svgShape === 'Random' ? randomShape() :
+ svgShape === 'Blob' ? generateBlobPath() :
+ svgShape;
+
shapes.update(items => [
...items,
- { id: items.length, path: svgShape, color, x: 0, y: 0, width: size, height: size }
+ { id: items.length, path: shapeToAdd, color, x: 0, y: 0, width: size, height: size }
]);
}
@@ -39,10 +123,22 @@
}
}
+ function updateColorPreview(event) {
+ const previewElement = event.target.nextElementSibling;
+ previewElement.style.backgroundColor = event.target.value;
+ }
+
+ function triggerColorInput(event) {
+ const inputElement = event.target.previousElementSibling;
+ inputElement.click();
+ }
+
function downloadSVG() {
const svgContent = `
`;
const blob = new Blob([svgContent], { type: 'image/svg+xml' });
@@ -111,46 +207,154 @@