etro 0.8.2 → 0.8.5
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/.github/workflows/nodejs.yml +5 -2
- package/CHANGELOG.md +23 -0
- package/CODE_OF_CONDUCT.md +1 -1
- package/CONTRIBUTING.md +1 -0
- package/README.md +30 -52
- package/dist/effect/base.d.ts +1 -1
- package/dist/effect/elliptical-mask.d.ts +4 -4
- package/dist/effect/index.d.ts +1 -0
- package/dist/effect/shader.d.ts +4 -4
- package/dist/effect/stack.d.ts +7 -7
- package/dist/effect/transform.d.ts +4 -4
- package/dist/effect/visual.d.ts +6 -0
- package/dist/etro-cjs.js +48 -6437
- package/dist/etro-iife.js +48 -6437
- package/dist/layer/audio-source.d.ts +1 -2
- package/dist/layer/visual.d.ts +3 -3
- package/dist/movie.d.ts +4 -4
- package/karma.conf.js +17 -1
- package/package.json +5 -10
- package/scripts/gen-effect-samples.html +27 -18
- package/scripts/save-effect-samples.js +6 -1
- package/src/effect/base.ts +1 -1
- package/src/effect/elliptical-mask.ts +4 -4
- package/src/effect/index.ts +1 -0
- package/src/effect/shader.ts +4 -4
- package/src/effect/stack.ts +10 -10
- package/src/effect/transform.ts +4 -4
- package/src/effect/visual.ts +6 -0
- package/src/layer/audio-source.ts +4 -5
- package/src/layer/visual.ts +10 -4
- package/src/movie.ts +32 -13
- package/.env +0 -2
- package/private-todo.txt +0 -70
- package/rename-file.sh +0 -18
- package/rename-versions.sh +0 -14
- package/rename.sh +0 -22
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
name: Node CI
|
|
2
2
|
|
|
3
|
-
on:
|
|
3
|
+
on:
|
|
4
|
+
- push
|
|
5
|
+
- pull_request
|
|
4
6
|
|
|
5
7
|
jobs:
|
|
6
8
|
build:
|
|
@@ -22,8 +24,9 @@ jobs:
|
|
|
22
24
|
- name: npm install, lint, build, and test
|
|
23
25
|
run: |
|
|
24
26
|
npm ci
|
|
27
|
+
node node_modules/puppeteer/install.js
|
|
25
28
|
npm run lint
|
|
26
29
|
npm run build
|
|
27
|
-
npm test
|
|
30
|
+
xvfb-run --auto-servernum npm test
|
|
28
31
|
env:
|
|
29
32
|
CI: true
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
7
7
|
|
|
8
|
+
## [0.8.5] - 2022-03-06
|
|
9
|
+
### Deprecated
|
|
10
|
+
- `vd.effect.Base` - All visual effects now inherit from `vd.effect.Visual` instead.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Movie constructor throwing `Can't find variable: AudioContext` on WebKit browsers.
|
|
14
|
+
|
|
15
|
+
## [0.8.4] - 2022-02-23
|
|
16
|
+
### Fixed
|
|
17
|
+
- **Major memory leak.**
|
|
18
|
+
- `Movie#play()` not resolving.
|
|
19
|
+
- `Movie#paused` set to false after done playing or recording.
|
|
20
|
+
- Movies' `currentTime` being off by a fraction of a second a few frames after playing.
|
|
21
|
+
- Movies' `currentTime` setter not respecting `autoRefresh`.
|
|
22
|
+
|
|
23
|
+
## [0.8.3] - 2022-01-18
|
|
24
|
+
### Fixed
|
|
25
|
+
- Recording not respecting the `type` option.
|
|
26
|
+
- Effects throwing 'empty canvas' errors when the target's width or height is 0.
|
|
27
|
+
|
|
8
28
|
## [0.8.2] - 2021-07-08
|
|
9
29
|
### Fixed
|
|
10
30
|
- `GaussianBlur` effect throwing a `TypeError` when applied to a movie or layer (the problem persisted).
|
|
@@ -188,6 +208,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
188
208
|
- Gaussian blur
|
|
189
209
|
- Transform
|
|
190
210
|
|
|
211
|
+
[0.8.5]: https://github.com/etro-js/etro/compare/v0.8.4...v0.8.5
|
|
212
|
+
[0.8.4]: https://github.com/etro-js/etro/compare/v0.8.3...v0.8.4
|
|
213
|
+
[0.8.3]: https://github.com/etro-js/etro/compare/v0.8.2...v0.8.3
|
|
191
214
|
[0.8.2]: https://github.com/etro-js/etro/compare/v0.8.1...v0.8.2
|
|
192
215
|
[0.8.1]: https://github.com/etro-js/etro/compare/v0.8.0...v0.8.1
|
|
193
216
|
[0.8.0]: https://github.com/etro-js/etro/compare/v0.7.0...v0.8.0
|
package/CODE_OF_CONDUCT.md
CHANGED
|
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
|
55
55
|
## Enforcement
|
|
56
56
|
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
-
reported by contacting
|
|
58
|
+
reported by contacting us at etroframework\@gmail.com. All complaints will be
|
|
59
59
|
reviewed and investigated and will result in a response that is deemed necessary
|
|
60
60
|
and appropriate to the circumstances. The project team is obligated to maintain
|
|
61
61
|
confidentiality with regard to the reporter of an incident. Further details of
|
package/CONTRIBUTING.md
CHANGED
package/README.md
CHANGED
|
@@ -3,25 +3,23 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/etro)
|
|
4
4
|
[](https://actions-badge.atrox.dev/etro-js/etro/goto)
|
|
5
5
|
|
|
6
|
-
>
|
|
7
|
-
>
|
|
8
|
-
> for migrating.
|
|
6
|
+
> Etro was previously known as Vidar, but it had to be renamed to avoid
|
|
7
|
+
> confusion with an existing software product.
|
|
9
8
|
|
|
10
|
-
Etro is a typescript framework for programmatically editing videos. Similar
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
and
|
|
15
|
-
own.
|
|
9
|
+
Etro is a typescript framework for programmatically editing videos. Similar to
|
|
10
|
+
GUI-based video-editing software, it lets you composite layers and add effects.
|
|
11
|
+
Etro comes shipped with text, video, audio and image layers, along with a bunch
|
|
12
|
+
of GLSL effects. You can also define your own layers and effects with javascript
|
|
13
|
+
and GLSL.
|
|
16
14
|
|
|
17
15
|
## Features
|
|
18
16
|
|
|
19
17
|
- Composite video and audio layers
|
|
20
18
|
- Use built-in hardware accelerated effects
|
|
21
19
|
- Write your own effects in JavaScript and GLSL
|
|
22
|
-
- Manipulate audio with the web audio API
|
|
23
|
-
- Define layer and effect
|
|
24
|
-
-
|
|
20
|
+
- Manipulate audio with the web audio API *(audio effects coming soon)*
|
|
21
|
+
- Define layer and effect parameters as keyframes or custom functions
|
|
22
|
+
- Render to a blob in realtime *(offline rendering coming soon)*
|
|
25
23
|
|
|
26
24
|
## Installation
|
|
27
25
|
|
|
@@ -29,29 +27,24 @@ own.
|
|
|
29
27
|
npm i etro
|
|
30
28
|
```
|
|
31
29
|
|
|
32
|
-
## Usage
|
|
30
|
+
## Basic Usage
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
Let's look at an example:
|
|
35
33
|
```js
|
|
36
34
|
import etro from 'etro'
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Or include it as a global etro:
|
|
40
|
-
```js
|
|
41
|
-
<script src="node_modules/etro/dist/etro-iife.js"></script>
|
|
42
|
-
```
|
|
43
35
|
|
|
44
|
-
Let's look at an example:
|
|
45
|
-
```js
|
|
46
36
|
var movie = new etro.Movie({ canvas: outputCanvas })
|
|
47
37
|
var layer = new etro.layer.Video({ startTime: 0, source: videoElement }) // the layer starts at 0s
|
|
48
38
|
movie.addLayer(layer)
|
|
39
|
+
|
|
49
40
|
movie.record({ frameRate: 24 }) // or just `play` if you don't need to save it
|
|
50
41
|
.then(blob => ...)
|
|
51
42
|
```
|
|
52
43
|
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
The blob could then be downloaded as a video file or displayed using a `<video>`
|
|
45
|
+
element.
|
|
46
|
+
|
|
47
|
+
## Effects
|
|
55
48
|
|
|
56
49
|
Effects can transform the output of a layer or movie:
|
|
57
50
|
```js
|
|
@@ -59,32 +52,23 @@ var layer = new etro.layer.Video({ startTime: 0, source: videoElement })
|
|
|
59
52
|
.addEffect(new etro.effect.Brightness({ brightness: +100) }))
|
|
60
53
|
```
|
|
61
54
|
|
|
62
|
-
##
|
|
63
|
-
|
|
64
|
-
To use Etro in Node, use the [wrapper](https://github.com/etro-js/etro-node):
|
|
65
|
-
```
|
|
66
|
-
npm i etro-node
|
|
67
|
-
```
|
|
55
|
+
## Dynamic Properties
|
|
68
56
|
|
|
57
|
+
Most properties also support keyframes and functions:
|
|
69
58
|
```js
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
movie
|
|
79
|
-
.exportRaw()
|
|
80
|
-
.then(window.done)
|
|
81
|
-
// Tell Etro Node what inputs to load with { id: path }
|
|
82
|
-
}, { input1: 'image.png' }, 'output.mp4')
|
|
59
|
+
// Keyframes
|
|
60
|
+
layer.effects[0].brightness = new etro.KeyFrame(
|
|
61
|
+
[0, -75], // brightness == -75 at 0 seconds
|
|
62
|
+
[2, +75] // +75 at 2 seconds
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
// Function
|
|
66
|
+
layer.effects[0].brightness = () => 100 * Math.random() - 50
|
|
83
67
|
```
|
|
84
68
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
69
|
+
## Using in Node
|
|
70
|
+
|
|
71
|
+
To use Etro in Node, see the [wrapper](https://github.com/etro-js/etro-node):
|
|
88
72
|
|
|
89
73
|
## Running the Examples
|
|
90
74
|
|
|
@@ -104,12 +88,6 @@ npm start
|
|
|
104
88
|
Now you can open any example (such as
|
|
105
89
|
http://127.0.0.1:8080/examples/introduction/hello-world1.html).
|
|
106
90
|
|
|
107
|
-
## TypeScript
|
|
108
|
-
|
|
109
|
-
Etro is written in TypeScript, so it should work out of the box with TypeScript
|
|
110
|
-
projects. However, it is also compatible with projects that do not use
|
|
111
|
-
TypeScript.
|
|
112
|
-
|
|
113
91
|
## Further Reading
|
|
114
92
|
|
|
115
93
|
- [Documentation](https://etrojs.dev/docs)
|
package/dist/effect/base.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Movie } from '../movie';
|
|
|
2
2
|
import { Visual } from '../layer/index';
|
|
3
3
|
import BaseObject from '../object';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* @deprecated All visual effects now inherit from `Visual` instead
|
|
6
6
|
*/
|
|
7
7
|
export declare class Base implements BaseObject {
|
|
8
8
|
type: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Movie } from '../movie';
|
|
2
2
|
import { Dynamic } from '../util';
|
|
3
|
-
import {
|
|
4
|
-
import { Visual } from '../layer/index';
|
|
3
|
+
import { Visual } from './visual';
|
|
4
|
+
import { Visual as VisualLayer } from '../layer/index';
|
|
5
5
|
export declare class EllipticalMaskOptions {
|
|
6
6
|
x: Dynamic<number>;
|
|
7
7
|
y: Dynamic<number>;
|
|
@@ -15,7 +15,7 @@ export declare class EllipticalMaskOptions {
|
|
|
15
15
|
/**
|
|
16
16
|
* Preserves an ellipse of the layer and clears the rest
|
|
17
17
|
*/
|
|
18
|
-
export declare class EllipticalMask extends
|
|
18
|
+
export declare class EllipticalMask extends Visual {
|
|
19
19
|
x: Dynamic<number>;
|
|
20
20
|
y: Dynamic<number>;
|
|
21
21
|
radiusX: Dynamic<number>;
|
|
@@ -27,5 +27,5 @@ export declare class EllipticalMask extends Base {
|
|
|
27
27
|
private _tmpCanvas;
|
|
28
28
|
private _tmpCtx;
|
|
29
29
|
constructor(options: EllipticalMaskOptions);
|
|
30
|
-
apply(target: Movie |
|
|
30
|
+
apply(target: Movie | VisualLayer, reltime: number): void;
|
|
31
31
|
}
|
package/dist/effect/index.d.ts
CHANGED
package/dist/effect/shader.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Visual } from '../layer/index';
|
|
1
|
+
import { Visual as VisualLayer } from '../layer/index';
|
|
2
2
|
import { Movie } from '../movie';
|
|
3
|
-
import {
|
|
3
|
+
import { Visual } from './visual';
|
|
4
4
|
export interface UniformOptions {
|
|
5
5
|
type?: string;
|
|
6
6
|
defaultFloatComponent?: number;
|
|
@@ -26,7 +26,7 @@ export interface ShaderOptions {
|
|
|
26
26
|
/**
|
|
27
27
|
* A hardware-accelerated pixel mapping using WebGL
|
|
28
28
|
*/
|
|
29
|
-
export declare class Shader extends
|
|
29
|
+
export declare class Shader extends Visual {
|
|
30
30
|
/**
|
|
31
31
|
* WebGL texture units consumed by {@link Shader}
|
|
32
32
|
*/
|
|
@@ -57,7 +57,7 @@ export declare class Shader extends Base {
|
|
|
57
57
|
private _initTextures;
|
|
58
58
|
private _initAttribs;
|
|
59
59
|
private _initUniforms;
|
|
60
|
-
apply(target: Movie |
|
|
60
|
+
apply(target: Movie | VisualLayer, reltime: number): void;
|
|
61
61
|
private _checkDimensions;
|
|
62
62
|
private _refreshGl;
|
|
63
63
|
private _enablePositionAttrib;
|
package/dist/effect/stack.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { Movie } from '../movie';
|
|
2
|
-
import {
|
|
3
|
-
import { Visual } from '../layer';
|
|
2
|
+
import { Visual } from './visual';
|
|
3
|
+
import { Visual as VisualLayer } from '../layer';
|
|
4
4
|
export interface StackOptions {
|
|
5
|
-
effects:
|
|
5
|
+
effects: Visual[];
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* A sequence of effects to apply, treated as one effect. This can be useful
|
|
9
9
|
* for defining reused effect sequences as one effect.
|
|
10
10
|
*/
|
|
11
|
-
export declare class Stack extends
|
|
12
|
-
readonly effects:
|
|
11
|
+
export declare class Stack extends Visual {
|
|
12
|
+
readonly effects: Visual[];
|
|
13
13
|
private _effectsBack;
|
|
14
14
|
constructor(options: StackOptions);
|
|
15
15
|
attach(movie: Movie): void;
|
|
16
16
|
detach(): void;
|
|
17
|
-
apply(target: Movie |
|
|
17
|
+
apply(target: Movie | VisualLayer, reltime: number): void;
|
|
18
18
|
/**
|
|
19
19
|
* Convenience method for chaining
|
|
20
20
|
* @param effect - the effect to append
|
|
21
21
|
*/
|
|
22
|
-
addEffect(effect:
|
|
22
|
+
addEffect(effect: Visual): Stack;
|
|
23
23
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Visual } from '../layer/index';
|
|
1
|
+
import { Visual as VisualLayer } from '../layer/index';
|
|
2
2
|
import { Movie } from '../movie';
|
|
3
3
|
import { Dynamic } from '../util';
|
|
4
|
-
import {
|
|
4
|
+
import { Visual } from './visual';
|
|
5
5
|
export interface TransformOptions {
|
|
6
6
|
matrix: Dynamic<Transform.Matrix>;
|
|
7
7
|
}
|
|
@@ -11,7 +11,7 @@ export interface TransformOptions {
|
|
|
11
11
|
* translations, scalings and rotations) or B) input the matrix values
|
|
12
12
|
* directly, using the optional argument in the constructor.
|
|
13
13
|
*/
|
|
14
|
-
declare class Transform extends
|
|
14
|
+
declare class Transform extends Visual {
|
|
15
15
|
/** Matrix that determines how to transform the target */
|
|
16
16
|
matrix: Dynamic<Transform.Matrix>;
|
|
17
17
|
private _tmpMatrix;
|
|
@@ -21,7 +21,7 @@ declare class Transform extends Base {
|
|
|
21
21
|
* @param matrix - matrix that determines how to transform the target
|
|
22
22
|
*/
|
|
23
23
|
constructor(options: TransformOptions);
|
|
24
|
-
apply(target: Movie |
|
|
24
|
+
apply(target: Movie | VisualLayer, reltime: number): void;
|
|
25
25
|
}
|
|
26
26
|
declare namespace Transform {
|
|
27
27
|
/**
|