fix: arc scale marks use same path-distance angle as progress
This commit is contained in:
@@ -133,15 +133,15 @@ function draw(cur,max){
|
|||||||
// scale marks along TOTAL path (arc + line)
|
// scale marks along TOTAL path (arc + line)
|
||||||
const mr=sr-gw/2-6,pr=sr+gw/2+6;
|
const mr=sr-gw/2-6,pr=sr+gw/2+6;
|
||||||
for(let r=0;r<=max;r+=2000){
|
for(let r=0;r<=max;r+=2000){
|
||||||
const t=r/max,p=pathPt(t);
|
const t=r/max,ad=t*totalLen;
|
||||||
if(r*totalLen/max<=arcLen){
|
if(ad<=arcLen){
|
||||||
const a=d2r(As+(Ae-As)*t);
|
const a=d2r(As+(Ae-As)*(ad/arcLen));
|
||||||
ctx.beginPath();ctx.moveTo(sx+mr*Math.cos(a),sy+mr*Math.sin(a));ctx.lineTo(sx+pr*Math.cos(a),sy+pr*Math.sin(a));
|
ctx.beginPath();ctx.moveTo(sx+mr*Math.cos(a),sy+mr*Math.sin(a));ctx.lineTo(sx+pr*Math.cos(a),sy+pr*Math.sin(a));
|
||||||
ctx.strokeStyle=r>=rl?'rgba(255,255,255,.15)':'rgba(255,255,255,.08)';
|
ctx.strokeStyle=r>=rl?'rgba(255,255,255,.15)':'rgba(255,255,255,.08)';
|
||||||
ctx.lineWidth=r%4000===0?2.5:1;ctx.stroke();
|
ctx.lineWidth=r%4000===0?2.5:1;ctx.stroke();
|
||||||
if(r%4000===0){ctx.fillStyle='rgba(255,255,255,.22)';ctx.font=`${Math.max(13,W/38)|0}px 'NEXT ART',sans-serif`;ctx.textAlign='center';ctx.fillText(Math.round(r/1000),sx+(pr+22)*Math.cos(a),sy+(pr+22)*Math.sin(a)+5)}
|
if(r%4000===0){ctx.fillStyle='rgba(255,255,255,.22)';ctx.font=`${Math.max(13,W/38)|0}px 'NEXT ART',sans-serif`;ctx.textAlign='center';ctx.fillText(Math.round(r/1000),sx+(pr+22)*Math.cos(a),sy+(pr+22)*Math.sin(a)+5)}
|
||||||
}else{
|
}else{
|
||||||
// on line portion: vertical marks
|
const p=pathPt(t);
|
||||||
ctx.beginPath();ctx.moveTo(p.x,ey-gw/2-4);ctx.lineTo(p.x,ey+gw/2+4);
|
ctx.beginPath();ctx.moveTo(p.x,ey-gw/2-4);ctx.lineTo(p.x,ey+gw/2+4);
|
||||||
ctx.strokeStyle=r>=rl?'rgba(255,255,255,.15)':'rgba(255,255,255,.08)';
|
ctx.strokeStyle=r>=rl?'rgba(255,255,255,.15)':'rgba(255,255,255,.08)';
|
||||||
ctx.lineWidth=r%4000===0?2.5:1;ctx.stroke();
|
ctx.lineWidth=r%4000===0?2.5:1;ctx.stroke();
|
||||||
|
|||||||
Reference in New Issue
Block a user