fragment-tools 0.2.9 → 0.2.10

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/.prettierrc DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "semi": true,
3
- "tabWidth": 4,
4
- "useTabs": true,
5
- "singleQuote": true,
6
- "printWidth": 80,
7
- "bracketSpacing": true,
8
- "trailingComma": "all",
9
- "plugins": ["prettier-plugin-svelte"],
10
- "overrides": [
11
- {
12
- "files": ["README.md", "packages/*/README.md", "**/package.json"],
13
- "options": {
14
- "useTabs": false,
15
- "tabWidth": 2
16
- }
17
- },
18
- {
19
- "files": ["docs/**/*.md"],
20
- "options": {
21
- "printWidth": 60
22
- }
23
- }
24
- ]
25
- }
package/CHANGELOG.md DELETED
@@ -1,10 +0,0 @@
1
- # fragment-tools
2
-
3
- ## 0.2.9
4
-
5
- ### Patch Changes
6
-
7
- - Prevent state mutations and warnings
8
- - Start templates on a green screen
9
- - Update examples
10
- - Prevent build layout re-render if layout is not persistent
@@ -1,44 +0,0 @@
1
- import loadMP4Module, { isWebCodecsSupported } from './mp4.js';
2
- import CanvasRecorder from './CanvasRecorder';
3
-
4
- let MP4;
5
-
6
- class MP4Recorder extends CanvasRecorder {
7
- static loaded = false;
8
- static isSupported = true;
9
-
10
- constructor(canvas, options) {
11
- super(canvas, options);
12
- }
13
-
14
- async load() {
15
- if (!MP4Recorder.loaded) {
16
- MP4 = await loadMP4Module();
17
-
18
- MP4Recorder.loaded = true;
19
- }
20
-
21
- this.encoder = MP4.createWebCodecsEncoder({
22
- width: this.canvas.width,
23
- height: this.canvas.height,
24
- fps: this.framerate,
25
- });
26
- }
27
-
28
- async tick() {
29
- const bitmap = await window.createImageBitmap(this.canvas);
30
-
31
- // Add bitmap to encoder
32
- await this.encoder.addFrame(bitmap);
33
- }
34
-
35
- async end() {
36
- const buffer = await this.encoder.end();
37
-
38
- this.result = new Blob([buffer], { type: 'video/mp4' });
39
-
40
- super.end();
41
- }
42
- }
43
-
44
- export default MP4Recorder;
@@ -1,29 +0,0 @@
1
- import WebMWriter from 'webm-writer';
2
- import { map } from '../../utils/math.utils';
3
- import CanvasRecorder from './CanvasRecorder';
4
-
5
- class WebMRecorder extends CanvasRecorder {
6
- start() {
7
- const quality = map(this.quality, 1, 100, 0, 0.99999);
8
-
9
- this.writer = new WebMWriter({
10
- quality,
11
- frameRate: this.framerate,
12
- });
13
-
14
- super.start();
15
- }
16
-
17
- tick() {
18
- this.writer.addFrame(this.canvas);
19
- }
20
-
21
- async end() {
22
- this.result = await this.writer.complete();
23
- this.writer = null;
24
-
25
- super.end();
26
- }
27
- }
28
-
29
- export default WebMRecorder;