-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple-test.js
More file actions
40 lines (31 loc) · 1007 Bytes
/
simple-test.js
File metadata and controls
40 lines (31 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
console.log('🔍 Testing setInterval in Node.js environment...');
let counter = 0;
console.log('Starting test...');
const testInterval = setInterval(() => {
counter++;
console.log(`Interval tick: ${counter}`);
if (counter >= 5) {
clearInterval(testInterval);
console.log('✅ setInterval test completed successfully!');
// Now test the animation logic
console.log('\n🎬 Testing animation logic...');
testAnimationLogic();
}
}, 500);
function testAnimationLogic() {
let cycles = 0;
let phase = 'swimming';
const animationInterval = setInterval(() => {
cycles++;
console.log(`Animation cycle: ${cycles}, Phase: ${phase}`);
if (cycles >= 3) {
phase = 'waking';
console.log('🔄 Phase changed to waking');
}
if (cycles >= 6) {
clearInterval(animationInterval);
console.log('✅ Animation logic test completed!');
console.log('The issue is not with setInterval or basic logic.');
}
}, 300);
}