Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
JavaScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647// Test ink function with new color+alpha patternimport { KidLispMini, parse } from './kidlisp-mini/eval.mjs';
const source = `(ink (? white black) (1s... 32 224))(circle w/2 h/2 100)`;
const ast = parse(source);const kidlisp = new KidLispMini();
// Mock API to track callsconst calls = [];const api = { screen: { width: 1280, height: 800 }, ink: (...args) => { calls.push({ fn: 'ink', args }); console.log(` ink(${args.map(a => Array.isArray(a) ? `[${a}]` : a).join(', ')})`); }, circle: (cx, cy, r) => { calls.push({ fn: 'circle', args: [cx, cy, r] }); console.log(` circle(${cx}, ${cy}, ${r})`); },};
kidlisp.setApi(api);
console.log('=== TEST: ink with color + alpha override ===\n');
// Test framesfor (let frame of [0, 30, 60]) { calls.length = 0; console.log(`Frame ${frame} (${(frame/60).toFixed(2)}s):`);
kidlisp.frameCount = frame; for (const expr of ast) { kidlisp.evalExpr(expr, kidlisp.globalEnv, api, frame); }
const inkCall = calls.find(c => c.fn === 'ink'); if (inkCall) { const [color, alpha] = inkCall.args; console.log(` → Color: ${Array.isArray(color) ? `[${color.join(',')}]` : color}, Alpha: ${alpha}`); } console.log();}
console.log('✅ ink pattern test complete');