@gehdoc/svg-to-video 0.29.4 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/dist/shared/analyzeSvgAnimation.js +17 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ Explore our **[Visual Gallery (Storybook)](https://gehdoc.github.io/svg-to-video
|
|
|
60
60
|
### Quick Start
|
|
61
61
|
|
|
62
62
|
1. Open the [Web Studio](https://gehdoc.github.io/svg-to-video/).
|
|
63
|
-
2. Drag and drop your `.svg` file.
|
|
63
|
+
2. Drag and drop your `.svg` file, or test the engine instantly with 1-click built-in samples.
|
|
64
64
|
3. Adjust resolution, duration, and FPS.
|
|
65
65
|
4. Select your format, toggle **Transparent Background** if needed, and ensure **High-Fidelity Capture** is enabled for best results.
|
|
66
66
|
5. Click **Export**.
|
|
@@ -151,6 +151,12 @@ The tool works by isolating the SVG, scrubbing the Web Animations API, and captu
|
|
|
151
151
|
|
|
152
152
|
---
|
|
153
153
|
|
|
154
|
+
## ❓ FAQ
|
|
155
|
+
|
|
156
|
+
Common questions about privacy, how frame scrubbing works, CI/CD automation, and transparency support are answered in **[docs/FAQ.md](./docs/FAQ.md)**.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
154
160
|
## 🤝 Contributing
|
|
155
161
|
|
|
156
162
|
Contributions are welcome! This project follows a **Spec-Driven Development (SDD)** workflow to ensure clear requirements and high quality. Please open an issue or pull request.
|
|
@@ -216,6 +216,19 @@ export const analyzeSvgAnimation = (svgContent, parserOverride) => {
|
|
|
216
216
|
}
|
|
217
217
|
return undefined;
|
|
218
218
|
};
|
|
219
|
+
/**
|
|
220
|
+
* Parses an SVG dimension attribute value (e.g. "100", "100px") into a pixel number.
|
|
221
|
+
* Returns NaN if the value is missing or uses relative/non-pixel units (e.g. "%", "em", "pt").
|
|
222
|
+
*/
|
|
223
|
+
export function parsePixelDimension(val) {
|
|
224
|
+
if (!val)
|
|
225
|
+
return NaN;
|
|
226
|
+
const match = val.trim().match(/^([\d.eE+-]+)\s*(px)?$/i);
|
|
227
|
+
if (!match)
|
|
228
|
+
return NaN;
|
|
229
|
+
const num = parseFloat(match[1]);
|
|
230
|
+
return isNaN(num) ? NaN : num;
|
|
231
|
+
}
|
|
219
232
|
/**
|
|
220
233
|
* Parses SVG content to extract width and height from width/height attributes or viewBox.
|
|
221
234
|
* Accepts an optional DOMParser override for non-browser environments.
|
|
@@ -231,8 +244,10 @@ export const parseSvgDimensions = (svgContent, parserOverride) => {
|
|
|
231
244
|
const svg = doc.querySelector('svg');
|
|
232
245
|
if (!svg)
|
|
233
246
|
throw new Error('Invalid SVG content');
|
|
234
|
-
|
|
235
|
-
|
|
247
|
+
const widthAttr = svg.getAttribute('width');
|
|
248
|
+
const heightAttr = svg.getAttribute('height');
|
|
249
|
+
let width = parsePixelDimension(widthAttr);
|
|
250
|
+
let height = parsePixelDimension(heightAttr);
|
|
236
251
|
const viewBox = svg.getAttribute('viewBox');
|
|
237
252
|
let isDimensionsDetected = !(isNaN(width) || isNaN(height));
|
|
238
253
|
if (!isDimensionsDetected && viewBox) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gehdoc/svg-to-video",
|
|
3
3
|
"mcpName": "io.github.GehDoc/svg-to-video",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.30.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Professional animated SVG to Video (MP4/WebM/MKV/MOV) and Animated Image (aPNG/GIF) converter featuring frame-accurate rendering, CLI automation, Model Context Protocol (MCP) server integration, and a serverless Web Studio.",
|
|
7
7
|
"imports": {
|