reframe-video 0.1.1 → 0.1.2
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/dist/analyze.js +44 -1
- package/dist/bin.js +262 -7
- package/dist/browserEntry.js +259 -3
- package/dist/cli.js +222 -5
- package/dist/index.js +510 -16
- package/dist/renderer-canvas.js +36 -0
- package/dist/trace-cli.js +677 -0
- package/dist/types/compile.d.ts +15 -1
- package/dist/types/compose.d.ts +12 -2
- package/dist/types/dsl.d.ts +27 -1
- package/dist/types/evaluate.d.ts +9 -0
- package/dist/types/index.d.ts +4 -1
- package/dist/types/ir.d.ts +67 -1
- package/dist/types/motion.d.ts +54 -0
- package/dist/types/path.d.ts +15 -0
- package/dist/types/presets.d.ts +41 -0
- package/guides/edsl-guide.md +19 -0
- package/package.json +1 -1
- package/preview/src/main.ts +62 -0
- package/preview/src/panel.ts +37 -3
- package/preview/src/store.ts +28 -2
package/dist/renderer-canvas.js
CHANGED
|
@@ -85,6 +85,29 @@ function drawDisplayList(ctx, ops, images) {
|
|
|
85
85
|
}
|
|
86
86
|
break;
|
|
87
87
|
}
|
|
88
|
+
case "path": {
|
|
89
|
+
const p = new Path2D(op.d);
|
|
90
|
+
if (op.fill) {
|
|
91
|
+
ctx.fillStyle = op.fill;
|
|
92
|
+
ctx.fill(p);
|
|
93
|
+
}
|
|
94
|
+
if (op.stroke && (op.strokeWidth ?? 1) > 0) {
|
|
95
|
+
ctx.strokeStyle = op.stroke;
|
|
96
|
+
ctx.lineWidth = op.strokeWidth ?? 1;
|
|
97
|
+
ctx.lineJoin = "round";
|
|
98
|
+
ctx.lineCap = "round";
|
|
99
|
+
if (op.progress < 1) {
|
|
100
|
+
const len = pathLength(op.d);
|
|
101
|
+
if (len > 0) {
|
|
102
|
+
ctx.setLineDash([len, len]);
|
|
103
|
+
ctx.lineDashOffset = len * (1 - op.progress);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
ctx.stroke(p);
|
|
107
|
+
ctx.setLineDash([]);
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
88
111
|
case "text": {
|
|
89
112
|
ctx.font = `${op.fontWeight} ${op.fontSize}px ${quoteFamily(op.fontFamily)}`;
|
|
90
113
|
if (op.letterSpacing) ctx.letterSpacing = `${op.letterSpacing}px`;
|
|
@@ -102,6 +125,19 @@ function drawDisplayList(ctx, ops, images) {
|
|
|
102
125
|
function quoteFamily(family) {
|
|
103
126
|
return family.includes(" ") && !family.includes('"') ? `"${family}"` : family;
|
|
104
127
|
}
|
|
128
|
+
var pathLengthCache = /* @__PURE__ */ new Map();
|
|
129
|
+
function pathLength(d) {
|
|
130
|
+
const hit = pathLengthCache.get(d);
|
|
131
|
+
if (hit !== void 0) return hit;
|
|
132
|
+
let len = 0;
|
|
133
|
+
if (typeof document !== "undefined") {
|
|
134
|
+
const el = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
135
|
+
el.setAttribute("d", d);
|
|
136
|
+
len = el.getTotalLength();
|
|
137
|
+
}
|
|
138
|
+
pathLengthCache.set(d, len);
|
|
139
|
+
return len;
|
|
140
|
+
}
|
|
105
141
|
export {
|
|
106
142
|
drawDisplayList,
|
|
107
143
|
renderFrame
|