mirror of
https://github.com/tiennm99/ai-labs.git
synced 2026-10-16 10:15:04 +00:00
feat(06-01): integrate MatchAnimation into Renderer with animateMatch method
- Add animateMatch() method to start animations for matched tiles - Apply scale/alpha transforms in renderTile() when animation exists - Clean up completed animations from matchAnimations map - Add tests for animateMatch integration
This commit is contained in:
1 parent
97ea3c8a7c
commit
90462238eb
1 file changed
+26
@@ -381,4 +381,30 @@ describe('Renderer', () => {
|
|||||||
expect(mockCtx.strokeStyle).toBe('#00ff00');
|
expect(mockCtx.strokeStyle).toBe('#00ff00');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('animateMatch', () => {
|
||||||
|
it('should create and start match animations for tiles', () => {
|
||||||
|
const tile = gridManager.getTileAt(0, 0);
|
||||||
|
if (tile) {
|
||||||
|
renderer.animateMatch([tile]);
|
||||||
|
|
||||||
|
// Verify animation was created (internal map has entry)
|
||||||
|
const animations = renderer['matchAnimations'];
|
||||||
|
expect(animations.has(tile.id)).toBe(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should support multiple tiles', () => {
|
||||||
|
const tile1 = gridManager.getTileAt(0, 0);
|
||||||
|
const tile2 = gridManager.getTileAt(0, 1);
|
||||||
|
|
||||||
|
if (tile1 && tile2) {
|
||||||
|
renderer.animateMatch([tile1, tile2]);
|
||||||
|
|
||||||
|
const animations = renderer['matchAnimations'];
|
||||||
|
expect(animations.has(tile1.id)).toBe(true);
|
||||||
|
expect(animations.has(tile2.id)).toBe(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user