@marcuth/movie.js 0.1.0 → 0.1.1

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.
@@ -64,26 +64,22 @@ class ImageClip extends clip_1.Clip {
64
64
  }
65
65
  if (this.scroll) {
66
66
  const cropOutput = `crop${context.inputIndex}`;
67
- const duration = this.duration;
68
67
  const easing = (_c = this.scroll.easing) !== null && _c !== void 0 ? _c : "linear";
69
- const p = (0, get_eased_expression_1.getEasedExpression)(`t/${duration}`, easing);
68
+ const totalFrames = this.duration * context.fps;
69
+ const p = (0, get_eased_expression_1.getEasedExpression)(`min(n/${totalFrames},1)`, easing);
70
+ const xExpr = this.scroll.axis === "x" && this.width
71
+ ? `if(gt(iw,${this.width}),min((iw-${this.width})*(${p}),iw-${this.width}),0)`
72
+ : "0";
73
+ const yExpr = this.scroll.axis === "y" && this.height
74
+ ? `if(gt(ih,${this.height}),min((ih-${this.height})*(${p}),ih-${this.height}),0)`
75
+ : "0";
70
76
  context.filters.push({
71
77
  filter: "crop",
72
78
  options: {
73
79
  w: (_d = this.width) !== null && _d !== void 0 ? _d : "iw",
74
80
  h: (_e = this.height) !== null && _e !== void 0 ? _e : "ih",
75
- x: `
76
- if(gt(iw,${this.width}),
77
- max(iw-${this.width},0)*${p},
78
- 0
79
- )
80
- `,
81
- y: `
82
- if(gt(ih,${this.height}),
83
- max(ih-${this.height},0)*${p},
84
- 0
85
- )
86
- `
81
+ x: xExpr,
82
+ y: yExpr
87
83
  },
88
84
  inputs: currentVideoOutput,
89
85
  outputs: cropOutput
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marcuth/movie.js",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Video template builder",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",