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.
@@ -1,6 +1,8 @@
1
1
  name: Node CI
2
2
 
3
- on: [push]
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
@@ -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 me at **\@etro-js** on Twitter. All complaints will be
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
@@ -20,6 +20,7 @@ Thank you for considering contributing to Etro! There are many ways you can cont
20
20
  git clone -b master --single-branch https://github.com/username/etro.git
21
21
  cd etro
22
22
  npm install
23
+ node node_modules/puppeteer/install.js
23
24
  ```
24
25
 
25
26
  ## Making your changes
package/README.md CHANGED
@@ -3,25 +3,23 @@
3
3
  [![](https://img.shields.io/npm/v/etro)](https://www.npmjs.com/package/etro)
4
4
  [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fetro-js%2Fetro%2Fbadge&style=flat)](https://actions-badge.atrox.dev/etro-js/etro/goto)
5
5
 
6
- > [Version 0.8 is out](https://etrojs.dev/blog/introducing-v0-8-0)!
7
- > Check out [this guide](https://etrojs.dev/docs/migrating-v0-8-0)
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
- to GUI-based video-editing software, it lets you layer media and other
12
- content on a timeline. Audio, image, video and other tracks are supported,
13
- along with powerful video effectts for existing tracks. Being very flexible
14
- and extendable, you can choose to only use the core components or define your
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 properties as keyframes and functions
24
- - Export to a blob or file
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
- You can use CommonJS syntax:
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
- This renders `videoElement` to a blob at 24 fps. This blob can then be
54
- downloaded as a video file.
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
- ## Using in Node
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
- var etroNode = require('etro-node')
71
-
72
- etroNode(() => {
73
- // You can access inputs as html elements and pass them to Etro as usual.
74
- var image = document.getElementById('input1') // <img> element
75
-
76
- // Use etro normally ...
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
- `etroNode()` takes an optional Puppeteer page argument, so you can run
86
- multiple Etro scripts on the same movie (useful for servers). See [the
87
- docs](https://github.com/etro-js/etro-node#documentation).
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)
@@ -2,7 +2,7 @@ import { Movie } from '../movie';
2
2
  import { Visual } from '../layer/index';
3
3
  import BaseObject from '../object';
4
4
  /**
5
- * Modifies the visual contents of a layer.
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 { Base } from './base';
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 Base {
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 | Visual, reltime: number): void;
30
+ apply(target: Movie | VisualLayer, reltime: number): void;
31
31
  }
@@ -13,3 +13,4 @@ export * from './pixelate';
13
13
  export * from './shader';
14
14
  export * from './stack';
15
15
  export * from './transform';
16
+ export * from './visual';
@@ -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 { Base } from './base';
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 Base {
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 | Visual, reltime: number): void;
60
+ apply(target: Movie | VisualLayer, reltime: number): void;
61
61
  private _checkDimensions;
62
62
  private _refreshGl;
63
63
  private _enablePositionAttrib;
@@ -1,23 +1,23 @@
1
1
  import { Movie } from '../movie';
2
- import { Base } from './base';
3
- import { Visual } from '../layer';
2
+ import { Visual } from './visual';
3
+ import { Visual as VisualLayer } from '../layer';
4
4
  export interface StackOptions {
5
- effects: Base[];
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 Base {
12
- readonly effects: Base[];
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 | Visual, reltime: number): void;
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: Base): Stack;
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 { Base } from './base';
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 Base {
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 | Visual, reltime: number): void;
24
+ apply(target: Movie | VisualLayer, reltime: number): void;
25
25
  }
26
26
  declare namespace Transform {
27
27
  /**
@@ -0,0 +1,6 @@
1
+ import { Base } from './base';
2
+ /**
3
+ * Modifies the visual contents of a layer.
4
+ */
5
+ export declare class Visual extends Base {
6
+ }