Effetti ambientali nelle altre 35 scene (lavoro di Codex): piccioni, merli, gatto, farfalle, libellula, falena, acqua che scorre, fontanella, tende, ombre delle fronde e delle nuvole
Controllato: test, partita completa e il giro di schermate degli effetti (npm run browser:effects). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ApqNBvNbNCwXqR2RLo8QJh
This commit is contained in:
@@ -85,5 +85,22 @@ test('gli effetti delle scene: tipi che il motore conosce, e dentro la scena', a
|
||||
for (const ph of [e.phase ?? []].flat()) assert.ok(phases.has(ph), `${id}: fase sconosciuta ${ph}`);
|
||||
const pts = [...(e.points ?? []), ...(e.at ? [e.at] : []), ...(e.area ? [e.area.slice(0, 2), [e.area[0] + e.area[2], e.area[1] + e.area[3]]] : []), ...(e.rects ?? []).map(r => r.slice(0, 2))];
|
||||
for (const [x, y] of pts) assert.ok(x >= 0 && x <= 640 && y >= 0 && y <= 360, `${id}: ${e.type} fuori scena`);
|
||||
if (e.clip) {
|
||||
assert.ok(e.clip.length >= 3, `${id}: ritaglio senza area`);
|
||||
for (const [x, y] of e.clip) assert.ok(Number.isFinite(x) && Number.isFinite(y) && x >= 0 && x <= 640 && y >= 0 && y <= 360, `${id}: ritaglio fuori scena`);
|
||||
}
|
||||
if (e.duration) assert.ok(e.duration > 0 && e.duration < e.every, `${id}: manca la pausa fra gli eventi`);
|
||||
}
|
||||
});
|
||||
|
||||
test('gli animali hanno vere pause e ingressi graduali, anche con offset diversi', async () => {
|
||||
const { ambientMoment } = await import('../src/engine/ambient.js');
|
||||
const timing = { every: 40000, duration: 10000, offset: 3000 };
|
||||
assert.equal(ambientMoment(8000, timing), null);
|
||||
assert.equal(ambientMoment(36000, timing), null);
|
||||
assert.deepEqual(ambientMoment(37000, timing), { t: 0, alpha: 0 });
|
||||
assert.equal(ambientMoment(42000, timing).alpha, 1);
|
||||
assert.ok(ambientMoment(46900, timing).alpha < 0.2);
|
||||
assert.equal(ambientMoment(47000, timing), null);
|
||||
assert.deepEqual(ambientMoment(42000, timing), ambientMoment(82000, timing));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user