@munusshih/p5.export 0.1.0-beta.10 → 0.1.0-beta.11
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 +13 -3
- package/dist/p5.export.js +1003 -988
- package/dist/p5.export.js.map +1 -1
- package/dist/p5.export.min.js +12 -8
- package/dist/p5.export.min.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# p5.export
|
|
2
2
|
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/munusshih/p5.export/main/p5.export.png" alt="p5.export panel previewing an animated p5.js sketch" width="900">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
3
7
|
[](https://www.npmjs.com/package/@munusshih/p5.export)
|
|
4
8
|
[](https://www.npmjs.com/package/@munusshih/p5.export)
|
|
5
9
|
[](./LICENSE)
|
|
@@ -121,7 +125,13 @@ function setup() {
|
|
|
121
125
|
### Video (record once, export to multiple formats)
|
|
122
126
|
|
|
123
127
|
```js
|
|
124
|
-
|
|
128
|
+
// Starts immediately. By default, export timing follows the rate set by
|
|
129
|
+
// frameRate(), so a frameRate(1) sketch remains one frame per second.
|
|
130
|
+
const buffer = createVideoBuffer({ duration: 3 });
|
|
131
|
+
|
|
132
|
+
// Record a sharper 2× render. Set fps only when you intentionally want to
|
|
133
|
+
// override the sketch's target frame rate.
|
|
134
|
+
const hiResBuffer = createVideoBuffer({ duration: 3, scale: 2, fps: 30 });
|
|
125
135
|
|
|
126
136
|
// later, after the buffer auto-stops or you call `stopVideoBuffer()`:
|
|
127
137
|
await exportVideoBuffer(buffer, { format: 'mp4', filename: 'clip' });
|
|
@@ -130,7 +140,7 @@ await exportVideoBuffer(buffer, { format: 'webp', filename: 'clip' }); // anima
|
|
|
130
140
|
await exportVideoBuffer(buffer, { format: 'gif', filename: 'clip' });
|
|
131
141
|
```
|
|
132
142
|
|
|
133
|
-
Frames are captured in real RGBA at the
|
|
143
|
+
Frames are captured in real RGBA at the sketch's target frame rate. Set `scale` from 1–4 to render the recording at that pixel density instead of enlarging the encoded pixels afterward. `exportVideoBuffer()` is re-callable on the same buffer — no re-recording — so users can pick the format they want from the GUI without losing the take.
|
|
134
144
|
|
|
135
145
|
You can also do a one-shot `recordVideo({ format: 'mp4', duration: 3, filename: 'clip' })` if you don't need the multi-format buffer.
|
|
136
146
|
|
|
@@ -157,7 +167,7 @@ createExportGUI({ title: 'my sketch', filename: 'artwork', collapsed: false });
|
|
|
157
167
|
removeExportGUI();
|
|
158
168
|
```
|
|
159
169
|
|
|
160
|
-
Drag from the header to move it. The two tabs (Image / Video) share the same compact form. The Video tab shows a low-res preview with a scrubbable timeline before you commit to encoding.
|
|
170
|
+
Drag from the header to move it. The two tabs (Image / Video) share the same compact form. The Video tab includes a 1×–4× recording scale and shows a low-res preview with a scrubbable timeline before you commit to encoding.
|
|
161
171
|
|
|
162
172
|
## Browser support
|
|
163
173
|
|