0xf94e2924…c3f2sent to0xa7d8d9ef…d270·#15,426,243·view on Etherscan
textureRec(u, x, y, w, h, c, c),
R = x + e < 0 || x + e > w || y + t < 0 || y + t > h;
if (!(i || p || m || R) && 0 != c) {
let e = max(0.1, (0.8 * height) / 1500);
circle(x * c, y * c, e);
}
}
pop();
}
function multiTexture(e, t, a) {
if (-1 != e.indexOf("-")) {
let [i, n] = e.split("-");
return 1 == a ? n : 0 == a || t < 0.2 ? i : n;
}
return e;
}
class Donut {
constructor(e, t, a, i, n, s, r, c, o = "all", l = "no", d) {
(this.a = e),
(this.b = t),
(this.c = a),
(this.d = i),
(this.nd = n),
(this.cs = s),
(this.textures = r),
(this.fillType = c),
(this.half = o),
(this.dilute = l),
(this.rarr = d),
(this.cpoints = []),
(this.radii = []);
}
calc() {
let e = [],
t = (0.7 * h) / this.nd;
this.cpoints[0] = [w / 2, 0.85 * h - t / 2];
for (let a = 0; a < nd; a++)
this.cpoints.push([
w / 2 + (max(this.rarr[a], 0.2) * w) / 18 - w / 36,
0.85 * h - t * (a + 1) - t / 2,
]),
e.push(
dist(
this.cpoints[a][0],
this.cpoints[a][1],
this.cpoints[a + 1][0],
this.cpoints[a + 1][1]
)
);
this.radii[0] = e[0] * constrain(gR, 0.68, 1);
for (let t = 0; t < nd; t++) this.radii[t + 1] = e[t] - this.radii[t];
}
show(e) {
let t = calcSize(this.nd, c);
for (let i = 0; i < this.nd; i++) {
let n = i == nd - 1 ? a + 0.5 + i : a,
s = calcBite(showBite, this.nd, i),
r = calcYpos(this.nd, h, i),
o = this.cs[(i + 1) % this.cs.length],
l = gR < 0.5 ? (i * TAU) / 8 / nd : TAU / 2 - (i * TAU) / 8 / nd,
d = max(3, int(10 * gR)),
f = multiTexture(this.textures, rarr[i], i),
u = calcVarSize(nd, i, t);
if ("cairn" == e) {
let e = max((0.6 * this.radii[i]) / c, 8);
doe(
this.cpoints[i][0],
this.cpoints[i][1],
n,
this.b,
this.c,
this.d,
(nd > d) & (i > nd - d) ? e * map(i - nd + d, 0, 3, 1, 1.45) : e,
cs[i % cs.length],
o,
s,
l,
f,
this.fillType,
"all",
"yes"
);
} else if ("grow" == e) {
let e = (0.8 * h) / nd / c / 4,
t = (0.7 * w) / nd,
a = (0.8 * h) / pow((0.7 * (nd - 0.5) * w) / nd, 2),
r = pow(t * i + t / 2 - 0.8 * w * (gR / 5), 2) * a;
doe(
t * i + t / 2,
0.95 * h - r - t,
n,
this.b,
this.c,
(nd > d) & (i > nd - d) & (rarr[i] > 0.3)
? this.d + exp(i / 15)
: this.d,
e * sqrt((t * (i + 0.5) * nd) / w / 1.5),
cs[int((t * i * nd) / w) % cs.length],
o,
s,
angle * sin(i) * cos(i),
f,
this.fillType
);
} else if ("radiate" == e || "uno" == e || "stack" == e) {
let n = ("stack" == e) & !((this.nd > 2) & (i % 3 == 1)) ? "off" : "on",
d = i % 2 == 0 ? 1.5 * t : 0,
g = i % 3 == 0 ? 2.5 * t : i % int(3 * gR + 2) == 1 ? 4 * t : t,
p = w / 8,
m = w / 2,
y = (gR > 0.6) & ("on" == n) ? u / 2 : u,
x = 2.6 * u,
R =
"stack" == e
? (this.nd > 5) & (gR > 0.5)
? 0.5 * w +
(w / 12) * sin(this.nd + i * map(gR, 0, 1, 0.5, 1)) * sqrt(i)
: 0.5 * w
: w / 2,
F = "uno" == e ? h / 2 : r,
_ = "radiate" == e ? d : "stack" == e ? y : p,
k = "radiate" == e ? g : "stack" == e ? x : m,
D = "uno" == e ? "flat" : "round",
T = ("stack" == e) & (nd > 2) & (rarr[i] > 0.6) ? 2.7 : 1.6;
doeDilute(
R,
F,
i != nd - 1 ? a + 0.5 + i : a,
b,
c,
T,
_,
k,
1 == nd ? cs[0] : cs[i % cs.length],
1 == nd ? cs[0] : o,
s,
l,
f,
fillType,
n,
"all",
D
);
} else if ("melt" == e) {
let e = 0.526;
for (let a = 0; a < 2; a++) {
let n = 0 == a ? "left" : "right";
doe(
0 == a ? 0.5 * w : w * e,
0 == a ? r : r - 1.1 * t,
0 == a
? rarr[i] > 0.6
? this.d + 2.1 * noise(i)
: this.d
: (rarr[i] < 0.4) & (i != this.nd - 1)
? this.d + 2.1 * noise(i)
: this.d,
this.b,
this.c,
rarr[i] < 0.6 || 0 == i || i == nd - 1
? this.d
: this.d + 2 * noise(i),
u,
cs[i % cs.length],
o,
s,
l,
f,
this.fillType,
n
);
}
strokeWeight((0.2 * height) / 1500);
for (let e = 0; e < 6; e++) {
let a = (u * c) / 2 + (e * (u * c)) / 5;
for (let e = 0; e < 2; e++) {
let n = 0 == e ? 0 - a : a,
s = "gradient" == fillType ? (0 == e ? i : i + 1) : i,
c = color(cs[s % cs.length]);
c.setAlpha(230),
stroke(c),
line(
0.5 * w,
r + n - 15 * gR,
0.526 * w,
r - 1.1 * t + n - 15 * gR
);
}
}
}
}
}
}