更新技术美术明亮教具室版:字体、指路、教学与庆祝效果

This commit is contained in:
toshiocn
2026-10-22 16:37:43 +08:00
parent 2d5a9e9553
commit 66b3ca4ea0
113 changed files with 7363 additions and 150 deletions
+24
View File
@@ -47,3 +47,27 @@ test('parity is a segment anchor; colour is not; flow moves continuously across
drawHint(ctx,{route:['a','b','c']},{a:[0,0],b:[100,0],c:[100,100]},50,300);
assert.deepEqual(arcs.at(-3).slice(0,2),[50,0]);
});
test('coral teaching ribbon preserves visited masks and offers direction in reduced motion',()=>{
for(const reducedMotion of [false,true]){
const strokes=[],fills=[],stack=[];
const ctx=new Proxy({globalCompositeOperation:'source-over',save(){stack.push(this.globalCompositeOperation);},restore(){this.globalCompositeOperation=stack.pop();},stroke(){strokes.push({color:this.strokeStyle,mode:this.globalCompositeOperation});},fill(){fills.push(this.globalCompositeOperation);}},{get:(o,k)=>o[k]??(()=>{}),set:(o,k,v)=>(o[k]=v,true)});
const path=['a'];
drawHint(ctx,{route:['a','b'],guides:[{a:'a',b:'b',points:[[0,0],[100,0]]}],visitedShapes:[{rings:[[[0,0],[20,0],[20,20],[0,20]]],radius:3,depth:3,maskPad:4}],keepouts:[{x:40,y:0,w:12,h:15}],reducedMotion},{},50,300,path);
assert.ok(strokes.some(s=>s.color==='#F49B75'));
assert.ok(strokes.filter(s=>s.color==='#C96E48'&&s.mode==='source-over').length>=1,'directional chevron');
assert.ok(fills.includes('destination-out'));
assert.equal(ctx.globalCompositeOperation,'source-over');
assert.deepEqual(path,['a']);
}
});
test('hint rounds shared guide junctions and keeps separate runs disconnected',async()=>{
const {smoothHintRuns}=await import('./src/hints.mjs');
const guides=[{a:'a',b:'b',points:[[0,0],[50,0]]},{a:'b',b:'c',points:[[50,0],[50,50]]},{a:'e',b:'f',points:[[100,0],[150,0]]}];
const runs=smoothHintRuns(guides,10);
assert.equal(runs.length,2);assert.deepEqual(runs[0][0],[0,0]);assert.deepEqual(runs[0].at(-1),[50,50]);
assert.ok(!runs[0].some(p=>p[0]===50&&p[1]===0),'sharp junction removed');
assert.ok(runs[0].some(p=>p[0]>40&&p[0]<50&&p[1]>0&&p[1]<10),'rounded transition');
assert.deepEqual(runs[1],[[100,0],[150,0]]);
});