x3d-image 1.0.2 → 1.0.3
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 +4 -0
- package/package.json +2 -2
- package/src/image.js +12 -0
- package/src/window.html +1 -1
package/README.md
CHANGED
|
@@ -28,6 +28,10 @@ Set image size in pixels, default is '1280x720'.
|
|
|
28
28
|
|
|
29
29
|
A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as JPEG).
|
|
30
30
|
|
|
31
|
+
### -d *delay*
|
|
32
|
+
|
|
33
|
+
Wait the specified number of milliseconds before generating the image.
|
|
34
|
+
|
|
31
35
|
## Supported Output File Types
|
|
32
36
|
|
|
33
37
|
| Description | File Extension | MIME Type |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x3d-image",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Generate image files from X3D.",
|
|
5
5
|
"main": "src/main.js",
|
|
6
6
|
"bin": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"start": "electron .",
|
|
11
|
-
"test": "npx . -s 1600x900 -i tests/IndexedFaceSet/IndexedFaceSet.x3d -o tests/test.jpg"
|
|
11
|
+
"test": "npx . -d 1000 -s 1600x900 -i tests/IndexedFaceSet/IndexedFaceSet.x3d -o tests/test.jpg"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
package/src/image.js
CHANGED
|
@@ -76,6 +76,13 @@ async function generate (argv)
|
|
|
76
76
|
description: "A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as JPEG).",
|
|
77
77
|
default: 1,
|
|
78
78
|
})
|
|
79
|
+
.option ("delay",
|
|
80
|
+
{
|
|
81
|
+
type: "number",
|
|
82
|
+
alias: "d",
|
|
83
|
+
description: "Wait the specified number of milliseconds before generating the image.",
|
|
84
|
+
default: 0,
|
|
85
|
+
})
|
|
79
86
|
.help ()
|
|
80
87
|
.alias ("help", "h") .argv
|
|
81
88
|
|
|
@@ -96,6 +103,9 @@ async function generate (argv)
|
|
|
96
103
|
|
|
97
104
|
await Browser .loadURL (new X3D .MFString (input))
|
|
98
105
|
|
|
106
|
+
if (args .delay)
|
|
107
|
+
await sleep (args .delay)
|
|
108
|
+
|
|
99
109
|
const blob = await generateImage (canvas, mimeType, args .quality)
|
|
100
110
|
|
|
101
111
|
fs .writeFileSync (output, new DataView (await blob .arrayBuffer ()))
|
|
@@ -120,3 +130,5 @@ function mimeTypeFromPath (filename)
|
|
|
120
130
|
return "image/png";
|
|
121
131
|
}
|
|
122
132
|
}
|
|
133
|
+
|
|
134
|
+
const sleep = delay => new Promise (resolve => setTimeout (resolve, delay))
|