Skip to content

Code-first video & image, rendered natively on WebGPU.

chore: fix lint in particles and clip vision

okanasl441f00b93b9e
diff --git a/nodes/node-particles/src/renderers/webgpu-renderer.ts b/nodes/node-particles/src/renderers/webgpu-renderer.ts
index 0dffeaef..fd9822aa 100644
--- a/nodes/node-particles/src/renderers/webgpu-renderer.ts
+++ b/nodes/node-particles/src/renderers/webgpu-renderer.ts
@@ -477,7 +477,9 @@ function packParams(
v(6, s.direction * deg, s.spread * deg, s.lifetime[0], s.lifetime[1]);
const attractors = f.attractors.slice(0, MAX_ATTRACTORS);
v(7, BOUNDS[s.bounds], s.floor ?? -1, s.bounce, attractors.length);
- attractors.forEach((a, i) => v(8 + i, a.x, a.y, a.strength, a.radius));
+ for (const [i, a] of attractors.entries()) {
+ v(8 + i, a.x, a.y, a.strength, a.radius);
+ }
const m = f.push?.mask;
v(16, m ? 1 : 0, f.push?.strength ?? 0, f.push?.sweep ?? 0, s.sizeJitter);
v(17, m?.originX ?? 0, m?.originY ?? 0, m?.scaleX ?? 1, m?.scaleY ?? 1);
@@ -492,7 +494,7 @@ function packParams(
);
const colors = s.colors.slice(0, MAX_COLORS);
v(21, colors.length, view.scaleX, view.scaleY, s.opacity);
- colors.forEach((c, i) => v(22 + i, c[0], c[1], c[2], c[3]));
+ for (const [i, c] of colors.entries()) v(22 + i, c[0], c[1], c[2], c[3]);
}
function stateFor(program: ParticleProgram, device: GPUDevice): SystemState {
diff --git a/packages/framefields/src/clip-vision.ts b/packages/framefields/src/clip-vision.ts
index dd07098d..f57e17b8 100644
--- a/packages/framefields/src/clip-vision.ts
+++ b/packages/framefields/src/clip-vision.ts
@@ -143,7 +143,8 @@ export class ClipVision {
}
private async compute(from: number, to: number): Promise<void> {
- await (this.cacheLoaded ??= this.loadCache());
+ this.cacheLoaded ??= this.loadCache();
+ await this.cacheLoaded;
let missing = false;
for (let c = from; c <= to; c++) if (!this.results.has(c)) missing = true;
if (!missing) return;
@@ -179,9 +180,9 @@ export class ClipVision {
const person = (await this.runner.pose(image)).people[0];
if (person) {
kp = new Float32Array(51);
- person.keypoints.forEach((p, k) =>
- kp?.set([p.x, p.y, p.visibility], k * 3),
- );
+ for (const [k, p] of person.keypoints.entries()) {
+ kp.set([p.x, p.y, p.visibility], k * 3);
+ }
}
}
if (wantMask) {