Diagonal gradients

rc-1.0.0
Mike Lynch 2025-01-06 10:28:18 +11:00
parent 22b02db4d4
commit 37711ee0e3
1 changed files with 12 additions and 4 deletions

View File

@ -6,10 +6,10 @@ const RADIUS_OPTS = [
"left", "left",
"up", "up",
"down", "down",
// "RU", "RU",
// "RD", "RD",
// "LU", "LU",
// "LD", "LD",
// "circle" // "circle"
]; ];
@ -53,6 +53,14 @@ class DotMaker {
return maxr * d.y / this.width; return maxr * d.y / this.width;
case "up": case "up":
return maxr * (this.width - d.y) / this.width; return maxr * (this.width - d.y) / this.width;
case "RU":
return 0.5 * maxr * (d.x + this.width - d.y) / this.width;
case "LU":
return 0.5 * maxr * (this.width - d.x + this.width - d.y) / this.width;
case "RD":
return 0.5 * maxr * (d.x + d.y) / this.width;
case "LD":
return 0.5 * maxr * (this.width - d.x + d.y) / this.width;
default: default:
return maxr; return maxr;
} }