etro 0.8.4 → 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/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ 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
+
8
15
  ## [0.8.4] - 2022-02-23
9
16
  ### Fixed
10
17
  - **Major memory leak.**
@@ -201,6 +208,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
201
208
  - Gaussian blur
202
209
  - Transform
203
210
 
211
+ [0.8.5]: https://github.com/etro-js/etro/compare/v0.8.4...v0.8.5
204
212
  [0.8.4]: https://github.com/etro-js/etro/compare/v0.8.3...v0.8.4
205
213
  [0.8.3]: https://github.com/etro-js/etro/compare/v0.8.2...v0.8.3
206
214
  [0.8.2]: https://github.com/etro-js/etro/compare/v0.8.1...v0.8.2
@@ -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/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 effects 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
+ }
package/dist/etro-cjs.js CHANGED
@@ -1181,7 +1181,7 @@ var index = /*#__PURE__*/Object.freeze({
1181
1181
  });
1182
1182
 
1183
1183
  /**
1184
- * Modifies the visual contents of a layer.
1184
+ * @deprecated All visual effects now inherit from `Visual` instead
1185
1185
  */
1186
1186
  var Base$1 = /** @class */ (function () {
1187
1187
  function Base() {
@@ -1274,6 +1274,17 @@ Base$1.prototype.type = 'effect';
1274
1274
  Base$1.prototype.publicExcludes = [];
1275
1275
  Base$1.prototype.propertyFilters = {};
1276
1276
 
1277
+ /**
1278
+ * Modifies the visual contents of a layer.
1279
+ */
1280
+ var Visual$1 = /** @class */ (function (_super) {
1281
+ __extends(Visual, _super);
1282
+ function Visual() {
1283
+ return _super !== null && _super.apply(this, arguments) || this;
1284
+ }
1285
+ return Visual;
1286
+ }(Base$1));
1287
+
1277
1288
  /**
1278
1289
  * A hardware-accelerated pixel mapping using WebGL
1279
1290
  */
@@ -1697,7 +1708,7 @@ var Shader = /** @class */ (function (_super) {
1697
1708
  Shader._VERTEX_SOURCE = "\n attribute vec4 a_VertexPosition;\n attribute vec2 a_TextureCoord;\n\n varying highp vec2 v_TextureCoord;\n\n void main() {\n // no need for projection or model-view matrices, since we're just rendering a rectangle\n // that fills the screen (see position values)\n gl_Position = a_VertexPosition;\n v_TextureCoord = a_TextureCoord;\n }\n ";
1698
1709
  Shader._IDENTITY_FRAGMENT_SOURCE = "\n precision mediump float;\n\n uniform sampler2D u_Source;\n\n varying highp vec2 v_TextureCoord;\n\n void main() {\n gl_FragColor = texture2D(u_Source, v_TextureCoord);\n }\n ";
1699
1710
  return Shader;
1700
- }(Base$1));
1711
+ }(Visual$1));
1701
1712
  // Shader.prototype.getpublicExcludes = () =>
1702
1713
  var isPowerOf2 = function (value) { return (value && (value - 1)) === 0; };
1703
1714
 
@@ -1871,7 +1882,7 @@ var EllipticalMask = /** @class */ (function (_super) {
1871
1882
  ctx.restore();
1872
1883
  };
1873
1884
  return EllipticalMask;
1874
- }(Base$1));
1885
+ }(Visual$1));
1875
1886
 
1876
1887
  /**
1877
1888
  * A sequence of effects to apply, treated as one effect. This can be useful
@@ -1935,7 +1946,7 @@ var Stack = /** @class */ (function (_super) {
1935
1946
  return this;
1936
1947
  };
1937
1948
  return Stack;
1938
- }(Base$1));
1949
+ }(Visual$1));
1939
1950
 
1940
1951
  /**
1941
1952
  * Applies a Gaussian blur
@@ -2159,7 +2170,7 @@ var Transform = /** @class */ (function (_super) {
2159
2170
  target.cctx.drawImage(this._tmpCanvas, 0, 0);
2160
2171
  };
2161
2172
  return Transform;
2162
- }(Base$1));
2173
+ }(Visual$1));
2163
2174
  (function (Transform) {
2164
2175
  /**
2165
2176
  * @class
@@ -2301,21 +2312,22 @@ var Transform = /** @class */ (function (_super) {
2301
2312
  */
2302
2313
 
2303
2314
  var index$1 = /*#__PURE__*/Object.freeze({
2315
+ GaussianBlur: GaussianBlur,
2316
+ GaussianBlurHorizontal: GaussianBlurHorizontal,
2317
+ GaussianBlurVertical: GaussianBlurVertical,
2304
2318
  Base: Base$1,
2305
- Brightness: Brightness,
2306
2319
  Channels: Channels,
2307
2320
  ChromaKey: ChromaKey,
2308
2321
  Contrast: Contrast,
2309
2322
  EllipticalMaskOptions: EllipticalMaskOptions,
2310
2323
  EllipticalMask: EllipticalMask,
2311
- GaussianBlur: GaussianBlur,
2312
- GaussianBlurHorizontal: GaussianBlurHorizontal,
2313
- GaussianBlurVertical: GaussianBlurVertical,
2324
+ Brightness: Brightness,
2314
2325
  Grayscale: Grayscale,
2315
2326
  Pixelate: Pixelate,
2316
2327
  Shader: Shader,
2317
2328
  Stack: Stack,
2318
- get Transform () { return Transform; }
2329
+ get Transform () { return Transform; },
2330
+ Visual: Visual$1
2319
2331
  });
2320
2332
 
2321
2333
  /**
@@ -2934,7 +2946,6 @@ var Movie = /** @class */ (function () {
2934
2946
  Movie.prototype.getDefaultOptions = function () {
2935
2947
  return {
2936
2948
  canvas: undefined,
2937
- _actx: new AudioContext(),
2938
2949
  /**
2939
2950
  * @name module:movie#background
2940
2951
  * @desc The css color for the background, or <code>null</code> for transparency
package/dist/etro-iife.js CHANGED
@@ -1182,7 +1182,7 @@ var etro = (function () {
1182
1182
  });
1183
1183
 
1184
1184
  /**
1185
- * Modifies the visual contents of a layer.
1185
+ * @deprecated All visual effects now inherit from `Visual` instead
1186
1186
  */
1187
1187
  var Base$1 = /** @class */ (function () {
1188
1188
  function Base() {
@@ -1275,6 +1275,17 @@ var etro = (function () {
1275
1275
  Base$1.prototype.publicExcludes = [];
1276
1276
  Base$1.prototype.propertyFilters = {};
1277
1277
 
1278
+ /**
1279
+ * Modifies the visual contents of a layer.
1280
+ */
1281
+ var Visual$1 = /** @class */ (function (_super) {
1282
+ __extends(Visual, _super);
1283
+ function Visual() {
1284
+ return _super !== null && _super.apply(this, arguments) || this;
1285
+ }
1286
+ return Visual;
1287
+ }(Base$1));
1288
+
1278
1289
  /**
1279
1290
  * A hardware-accelerated pixel mapping using WebGL
1280
1291
  */
@@ -1698,7 +1709,7 @@ var etro = (function () {
1698
1709
  Shader._VERTEX_SOURCE = "\n attribute vec4 a_VertexPosition;\n attribute vec2 a_TextureCoord;\n\n varying highp vec2 v_TextureCoord;\n\n void main() {\n // no need for projection or model-view matrices, since we're just rendering a rectangle\n // that fills the screen (see position values)\n gl_Position = a_VertexPosition;\n v_TextureCoord = a_TextureCoord;\n }\n ";
1699
1710
  Shader._IDENTITY_FRAGMENT_SOURCE = "\n precision mediump float;\n\n uniform sampler2D u_Source;\n\n varying highp vec2 v_TextureCoord;\n\n void main() {\n gl_FragColor = texture2D(u_Source, v_TextureCoord);\n }\n ";
1700
1711
  return Shader;
1701
- }(Base$1));
1712
+ }(Visual$1));
1702
1713
  // Shader.prototype.getpublicExcludes = () =>
1703
1714
  var isPowerOf2 = function (value) { return (value && (value - 1)) === 0; };
1704
1715
 
@@ -1872,7 +1883,7 @@ var etro = (function () {
1872
1883
  ctx.restore();
1873
1884
  };
1874
1885
  return EllipticalMask;
1875
- }(Base$1));
1886
+ }(Visual$1));
1876
1887
 
1877
1888
  /**
1878
1889
  * A sequence of effects to apply, treated as one effect. This can be useful
@@ -1936,7 +1947,7 @@ var etro = (function () {
1936
1947
  return this;
1937
1948
  };
1938
1949
  return Stack;
1939
- }(Base$1));
1950
+ }(Visual$1));
1940
1951
 
1941
1952
  /**
1942
1953
  * Applies a Gaussian blur
@@ -2160,7 +2171,7 @@ var etro = (function () {
2160
2171
  target.cctx.drawImage(this._tmpCanvas, 0, 0);
2161
2172
  };
2162
2173
  return Transform;
2163
- }(Base$1));
2174
+ }(Visual$1));
2164
2175
  (function (Transform) {
2165
2176
  /**
2166
2177
  * @class
@@ -2302,21 +2313,22 @@ var etro = (function () {
2302
2313
  */
2303
2314
 
2304
2315
  var index$1 = /*#__PURE__*/Object.freeze({
2316
+ GaussianBlur: GaussianBlur,
2317
+ GaussianBlurHorizontal: GaussianBlurHorizontal,
2318
+ GaussianBlurVertical: GaussianBlurVertical,
2305
2319
  Base: Base$1,
2306
- Brightness: Brightness,
2307
2320
  Channels: Channels,
2308
2321
  ChromaKey: ChromaKey,
2309
2322
  Contrast: Contrast,
2310
2323
  EllipticalMaskOptions: EllipticalMaskOptions,
2311
2324
  EllipticalMask: EllipticalMask,
2312
- GaussianBlur: GaussianBlur,
2313
- GaussianBlurHorizontal: GaussianBlurHorizontal,
2314
- GaussianBlurVertical: GaussianBlurVertical,
2325
+ Brightness: Brightness,
2315
2326
  Grayscale: Grayscale,
2316
2327
  Pixelate: Pixelate,
2317
2328
  Shader: Shader,
2318
2329
  Stack: Stack,
2319
- get Transform () { return Transform; }
2330
+ get Transform () { return Transform; },
2331
+ Visual: Visual$1
2320
2332
  });
2321
2333
 
2322
2334
  /**
@@ -2935,7 +2947,6 @@ var etro = (function () {
2935
2947
  Movie.prototype.getDefaultOptions = function () {
2936
2948
  return {
2937
2949
  canvas: undefined,
2938
- _actx: new AudioContext(),
2939
2950
  /**
2940
2951
  * @name module:movie#background
2941
2952
  * @desc The css color for the background, or <code>null</code> for transparency
@@ -1,6 +1,6 @@
1
1
  import { Dynamic } from '../util';
2
2
  import { Base, BaseOptions } from './base';
3
- import { Base as BaseEffect } from '../effect/base';
3
+ import { Visual as VisualEffect } from '../effect/visual';
4
4
  interface VisualOptions extends BaseOptions {
5
5
  x?: Dynamic<number>;
6
6
  y?: Dynamic<number>;
@@ -33,7 +33,7 @@ declare class Visual extends Base {
33
33
  * The context of {@link Visual#canvas}
34
34
  */
35
35
  readonly cctx: CanvasRenderingContext2D;
36
- readonly effects: BaseEffect[];
36
+ readonly effects: VisualEffect[];
37
37
  private _effectsBack;
38
38
  /**
39
39
  * Creates a visual layer
@@ -52,7 +52,7 @@ declare class Visual extends Base {
52
52
  * @param effect
53
53
  * @return the layer (for chaining)
54
54
  */
55
- addEffect(effect: BaseEffect): Visual;
55
+ addEffect(effect: VisualEffect): Visual;
56
56
  getDefaultOptions(): VisualOptions;
57
57
  }
58
58
  export { Visual, VisualOptions };
package/dist/movie.d.ts CHANGED
@@ -188,7 +188,5 @@ export declare class Movie {
188
188
  get height(): number;
189
189
  set height(height: number);
190
190
  get movie(): Movie;
191
- getDefaultOptions(): MovieOptions & {
192
- _actx: AudioContext;
193
- };
191
+ getDefaultOptions(): MovieOptions;
194
192
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "etro",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "An extendable video-editing framework for the browser and Node",
5
5
  "browser": "dist/etro-cjs.js",
6
6
  "types": "dist/index.d.ts",
@@ -33,7 +33,7 @@
33
33
  "karma-super-dots-reporter": "^0.2.0",
34
34
  "keep-a-changelog": "^0.10.4",
35
35
  "puppeteer": "^2.0.0",
36
- "resemblejs": "^3.2.5",
36
+ "resemblejs": "^4.1.0",
37
37
  "rollup": "^1.19.4",
38
38
  "rollup-plugin-cleaner": "^1.0.0",
39
39
  "rollup-plugin-eslint": "^7.0.0",
@@ -5,7 +5,7 @@ import { Visual } from '../layer/index'
5
5
  import BaseObject from '../object'
6
6
 
7
7
  /**
8
- * Modifies the visual contents of a layer.
8
+ * @deprecated All visual effects now inherit from `Visual` instead
9
9
  */
10
10
  export class Base implements BaseObject {
11
11
  type: string
@@ -1,7 +1,7 @@
1
1
  import { Movie } from '../movie'
2
2
  import { Dynamic, val } 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
 
6
6
  export class EllipticalMaskOptions {
7
7
  x: Dynamic<number>
@@ -18,7 +18,7 @@ export class EllipticalMaskOptions {
18
18
  * Preserves an ellipse of the layer and clears the rest
19
19
  */
20
20
  // TODO: Parent layer mask effects will make more complex masks easier
21
- export class EllipticalMask extends Base {
21
+ export class EllipticalMask extends Visual {
22
22
  x: Dynamic<number>
23
23
  y: Dynamic<number>
24
24
  radiusX: Dynamic<number>
@@ -46,7 +46,7 @@ export class EllipticalMask extends Base {
46
46
  this._tmpCtx = this._tmpCanvas.getContext('2d')
47
47
  }
48
48
 
49
- apply (target: Movie | Visual, reltime: number): void {
49
+ apply (target: Movie | VisualLayer, reltime: number): void {
50
50
  const ctx = target.cctx
51
51
  const canvas = target.canvas
52
52
  const x = val(this, 'x', reltime)
@@ -20,3 +20,4 @@ export * from './pixelate'
20
20
  export * from './shader'
21
21
  export * from './stack'
22
22
  export * from './transform'
23
+ export * from './visual'
@@ -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 { val } from '../util'
4
- import { Base } from './base'
4
+ import { Visual } from './visual'
5
5
 
6
6
  export interface UniformOptions {
7
7
  type?: string
@@ -32,7 +32,7 @@ export interface ShaderOptions {
32
32
  * A hardware-accelerated pixel mapping using WebGL
33
33
  */
34
34
  // TODO: can `v_TextureCoord` be replaced by `gl_FragUV`?
35
- export class Shader extends Base {
35
+ export class Shader extends Visual {
36
36
  /**
37
37
  * WebGL texture units consumed by {@link Shader}
38
38
  */
@@ -196,7 +196,7 @@ export class Shader extends Base {
196
196
  }
197
197
  } */
198
198
 
199
- apply (target: Movie | Visual, reltime: number): void {
199
+ apply (target: Movie | VisualLayer, reltime: number): void {
200
200
  this._checkDimensions(target)
201
201
  this._refreshGl()
202
202
 
@@ -1,19 +1,19 @@
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
 
5
5
  export interface StackOptions {
6
- effects: Base[]
6
+ effects: Visual[]
7
7
  }
8
8
 
9
9
  /**
10
10
  * A sequence of effects to apply, treated as one effect. This can be useful
11
11
  * for defining reused effect sequences as one effect.
12
12
  */
13
- export class Stack extends Base {
14
- readonly effects: Base[]
13
+ export class Stack extends Visual {
14
+ readonly effects: Visual[]
15
15
 
16
- private _effectsBack: Base[]
16
+ private _effectsBack: Visual[]
17
17
 
18
18
  constructor (options: StackOptions) {
19
19
  super()
@@ -21,13 +21,13 @@ export class Stack extends Base {
21
21
  this._effectsBack = []
22
22
  // TODO: Throw 'change' events in handlers
23
23
  this.effects = new Proxy(this._effectsBack, {
24
- deleteProperty: function (target: Base[], property: number | string): boolean {
24
+ deleteProperty: function (target: Visual[], property: number | string): boolean {
25
25
  const value = target[property]
26
26
  value.detach() // Detach effect from movie
27
27
  delete target[property]
28
28
  return true
29
29
  },
30
- set: function (target: Base[], property: number | string, value: Base): boolean {
30
+ set: function (target: Visual[], property: number | string, value: Visual): boolean {
31
31
  // TODO: make sure type check works
32
32
  if (!isNaN(Number(property))) { // if property is a number (index)
33
33
  if (target[property])
@@ -59,7 +59,7 @@ export class Stack extends Base {
59
59
  })
60
60
  }
61
61
 
62
- apply (target: Movie | Visual, reltime: number): void {
62
+ apply (target: Movie | VisualLayer, reltime: number): void {
63
63
  for (let i = 0; i < this.effects.length; i++) {
64
64
  const effect = this.effects[i]
65
65
  if (!effect) continue
@@ -71,7 +71,7 @@ export class Stack extends Base {
71
71
  * Convenience method for chaining
72
72
  * @param effect - the effect to append
73
73
  */
74
- addEffect (effect: Base): Stack {
74
+ addEffect (effect: Visual): Stack {
75
75
  this.effects.push(effect)
76
76
  return this
77
77
  }
@@ -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 { val, Dynamic } from '../util'
4
- import { Base } from './base'
4
+ import { Visual } from './visual'
5
5
 
6
6
  export interface TransformOptions {
7
7
  matrix: Dynamic<Transform.Matrix> // eslint-disable-line no-use-before-define
@@ -13,7 +13,7 @@ export interface TransformOptions {
13
13
  * translations, scalings and rotations) or B) input the matrix values
14
14
  * directly, using the optional argument in the constructor.
15
15
  */
16
- class Transform extends Base {
16
+ class Transform extends Visual {
17
17
  /** Matrix that determines how to transform the target */
18
18
  matrix: Dynamic<Transform.Matrix>
19
19
 
@@ -35,7 +35,7 @@ class Transform extends Base {
35
35
  this._tmpCtx = this._tmpCanvas.getContext('2d')
36
36
  }
37
37
 
38
- apply (target: Movie | Visual, reltime: number): void {
38
+ apply (target: Movie | VisualLayer, reltime: number): void {
39
39
  if (target.canvas.width !== this._tmpCanvas.width)
40
40
  this._tmpCanvas.width = target.canvas.width
41
41
 
@@ -0,0 +1,6 @@
1
+ import { Base } from './base'
2
+
3
+ /**
4
+ * Modifies the visual contents of a layer.
5
+ */
6
+ export class Visual extends Base {}
@@ -1,6 +1,6 @@
1
1
  import { Dynamic, val, applyOptions } from '../util'
2
2
  import { Base, BaseOptions } from './base'
3
- import { Base as BaseEffect } from '../effect/base'
3
+ import { Visual as VisualEffect } from '../effect/visual'
4
4
 
5
5
  interface VisualOptions extends BaseOptions {
6
6
  x?: Dynamic<number>
@@ -41,9 +41,9 @@ class Visual extends Base {
41
41
  readonly cctx: CanvasRenderingContext2D
42
42
 
43
43
  // readonly because it's a proxy
44
- readonly effects: BaseEffect[]
44
+ readonly effects: VisualEffect[]
45
45
 
46
- private _effectsBack: BaseEffect[]
46
+ private _effectsBack: VisualEffect[]
47
47
 
48
48
  /**
49
49
  * Creates a visual layer
@@ -142,7 +142,7 @@ class Visual extends Base {
142
142
  * @param effect
143
143
  * @return the layer (for chaining)
144
144
  */
145
- addEffect (effect: BaseEffect): Visual {
145
+ addEffect (effect: VisualEffect): Visual {
146
146
  this.effects.push(effect); return this
147
147
  }
148
148
 
package/src/movie.ts CHANGED
@@ -698,10 +698,9 @@ export class Movie {
698
698
  return this
699
699
  }
700
700
 
701
- getDefaultOptions (): MovieOptions & { _actx: AudioContext } {
701
+ getDefaultOptions (): MovieOptions {
702
702
  return {
703
703
  canvas: undefined, // required
704
- _actx: new AudioContext(),
705
704
  /**
706
705
  * @name module:movie#background
707
706
  * @desc The css color for the background, or <code>null</code> for transparency
package/.env DELETED
@@ -1,2 +0,0 @@
1
- GITHUB_TOKEN=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
2
- NPM_AUTH_TOKEN=9f33f7fb-82a2-4e87-a4ba-3860f13a3b68
package/private-todo.txt DELETED
@@ -1,70 +0,0 @@
1
- (A) 2021-04-21 offline recording with ffmpeg.wasm
2
- (A) 2021-04-21 document events
3
- (A) 2021-05-17 test recording to mp4
4
- (A) 2021-05-17 test that keyframes extend last frame for infinity!!
5
- (B) 2020-08-03 make sure each event's purpose is to notify the public world of notable things that happen in the object.
6
- (B) 2020-08-27 transitions?
7
- (B) 2020-12-30 emit modify events when effects are added to layer?
8
- (B) 2020-12-30 ensure order of `set` and `deleteProperty` are correct in array proxy with `pop`
9
- (B) 2021-04-12 disable autoRefresh in tests and test integration with this switch some other way
10
- (C) 2019-10-13 idea: layer inheritance
11
- (C) 2019-10-13 ignore leading underscore in shader uniform property names
12
- (C) 2019-10-13 fix opacity with shader effects
13
- (C) 2020-08-08 Replace val(element, 'property', reltime) with element.property.value
14
- (C) 2020-08-12 call URL.revokeObjectURL when recording
15
- (C) 2020-12-30 simplify movie.change.* into movie.change
16
- (C) 2021-03-28 make all color properties use `Color`
17
- (C) 2021-04-02 abort recording
18
- (C) 2021-04-21 webcam example doesn't work on FF unless autoRefresh is set to false
19
- (C) 2021-07-13 make all layers canvases the same size as the movie
20
- (C) 2021-07-18 movie stops recording a few frames late when duration is supplied
21
- (D) 2019-10-15 change chroma key constructor signature
22
- (D) 2019-11-11 treat zero as invalid for pixelate radius
23
- (D) 2019-11-11 decide on effect.Transform using hardware acceleration
24
- (D) 2019-11-18 Look at linearInterp objectKeys default value
25
- (D) 2019-12-25 Rename `Stack` to something else
26
- (D) 2020-08-02 Not every option should be set as a property on the object
27
- (D) 2021-01-24 Remove path support in val (because users would expect it to evaluate every path part)
28
- (D) 2021-01-26 Fix inheritance checking for media mixin
29
- (D) 2021-01-26 Media docstring type
30
- (D) 2021-01-26 Call super in all media mixin methods
31
- (D) 2021-01-27 Use options.js
32
- (D) 2021-04-02 error on invalid `record` options
33
- (D) 2021-04-12 use val() when recalculating AudioSource#duration based on playbackRate
34
- (D) 2021-07-09 multiple layers of proxies in watched objects
35
-
36
- x (B) 2021-04-12 make error range for pixel tests
37
- x (C) 2021-02-26 make sure that movie background gets val'd
38
- x (B) 2021-04-03 expose MovieOptions
39
- x (D) 2019-10-09 probably convert to typescript
40
- x (C) 2019-10-22 make image and video both extend a mixin
41
- x (C) 2021-04-03 2019-01-07 record for interval of time
42
- x (B) 2021-04-03 2021-04-03 add missing properties to MixedVisualSource
43
- x (D) 2021-04-03 2021-04-03 move opacity out of `border` in Visual
44
- x (B) 2021-01-28 2020-12-18 split layers up into multiple files
45
- x (B) 2021-01-28 2020-12-18 split effects up into multiple files
46
- x (B) 2020-08-27 individual interpolation for keyframe sets
47
- x (B) 2019-12-24 support node
48
- x (B) 2020-12-31 2020-12-30 Detach effect when replaced in layer
49
- x (D) 2020-12-18 2020-08-02 Rename `cctx` -> `vctx`
50
- x (B) 2019-01-02 fix movie record test failing with GitHub actions
51
- x (B) 2020-08-03 2020-08-03 don't set Image#clipWidth in init
52
- x (B) 2020-08-03 2020-08-03 remove properties like Video#mediaWidth, effectively removing layer borders
53
- x (B) 2020-08-03 2019-10-04 decide on the purpose of events - it's to notify the outside world of notable things that happen in the object
54
- x (B) 2019-12-25 decide on public / private properties
55
- x (C) 2019-12-25 2019-12-24 make getDefaultOptions private
56
- x (D) 2019-11-18 Change Color constructor default a from 255 -> 1.0
57
- x (A) 2019-12-06 2019-11-11 Start roadmap
58
- x (A) 2019-11-19 2019-10-22 Util tests
59
- x (A) 2019-10-22 Effect tests
60
- x (D) 2019-11-18 2019-11-18 update watchPublic description, removing part that says "after all public properties are initialized in constructor"
61
- x (B) 2019-10-13 mv examples/media examples/assets
62
- x (A) 2019-10-22 2019-10-22 Layer tests
63
- x (B) 2019-10-12 support media live streams
64
- x (C) 2019-10-03 research if dist/etris-esm.js is necessary
65
- x (A) 2019-10-04 upload to npm
66
- x (C) 2019-10-07 lint examples
67
- x (B) 2019-10-04 fix jsdoc comments after linting
68
- x (A) 2019-10-07 2019-10-07 fix recording silent movie on chrome
69
- x (A) 2019-10-05 2019-10-03 research if I can include open media in my repo
70
- x 2019-10-04 2019-10-03 use one of eslint's official configs
package/rename-file.sh DELETED
@@ -1,18 +0,0 @@
1
- #!/usr/bin/bash
2
-
3
- set -e
4
-
5
- file=$1
6
-
7
- # Update file contents
8
- sed -i 's/clabe45.github.io\/vidar/etrojs.dev/g' $file
9
- sed -i 's/calebsacks.me\/vidar/etrojs.dev/g' $file
10
- sed -i 's/vidar/etro/g' $file
11
- sed -i 's/Vidar/Etro/g' $file
12
- sed -i 's/vd/etro/g' $file
13
- sed -i 's/clabe45/etro-js/g' $file
14
-
15
- # Update file name
16
- rename 's/vidar/etro/' $file
17
-
18
- echo "Updated $file"
@@ -1,14 +0,0 @@
1
- #!/usr/bin/bash
2
-
3
- set -e
4
-
5
- for version in "$@"
6
- do
7
- git checkout v$version
8
-
9
- $(dirname "$0")/rename.sh
10
-
11
- git tag v$version-renamed
12
-
13
- echo ""
14
- done
package/rename.sh DELETED
@@ -1,22 +0,0 @@
1
- #!/usr/bin/bash
2
-
3
- set -e
4
-
5
- find -type f -not -name 'rename*.sh' -not -path '*./package-lock.json' -not -path '*./.git/*' -not -path '*./node_modules/*' -exec $(dirname "$0")/rename-file.sh {} \;
6
- jq '.author = "Caleb Sacks (https://calebsacks.me)"' package.json > package.json.tmp
7
- mv package.json{.tmp,}
8
-
9
- set +e
10
-
11
- npm i && npm run lint --if-present && npm run build --if-present && npm run test --if-present
12
-
13
- if [[ $? -ne 0 ]]
14
- then
15
- read -p "CI workflow failed. Press [Enter] to continue or Ctrl-C to exit" _
16
- fi
17
-
18
- set -e
19
-
20
- git add .
21
- git rm --cached rename*.sh
22
- force_commit=true git commit -m "Rename project to 'etro'"