0xf94e2924…c3f2sent to0xc74ec888…009f·#18,660,288·view on Etherscan
var s,
layout,
dome,
blobs,
blobs2,
dark,
light,
base,
today,
uH,
uD,
uM,
fastForwardRate,
randomMonth,
colGap,
gR,
version = 3.8,
nBlob = 6,
nCol = 8,
uDmaxTimeRange = 31,
uMmaxTimeRange = 12,
uHmaxTimeRange = 24,
rarr = [],
rarro = [];
function calculateFeatures($) {
let o = new (class o {
constructor() {
this.useA = !1;
let o = function ($) {
let o = parseInt($.substr(0, 8), 16),
l = parseInt($.substr(8, 8), 16),
n = parseInt($.substr(16, 8), 16),
e = parseInt($.substr(24, 8), 16);
return function () {
n |= 0;
let $ = ((((o |= 0) + (l |= 0)) | 0) + (e |= 0)) | 0;
return (
(e = (e + 1) | 0),
(o = l ^ (l >>> 9)),
(l = (n + (n << 3)) | 0),
(n = ((n = (n << 21) | (n >>> 11)) + $) | 0),
($ >>> 0) / 4294967296
);
};
};
(this.prngA = new o($.hash.substr(2, 32))),
(this.prngB = new o($.hash.substr(34, 32)));
for (let l = 0; l < 1e6; l += 2) this.prngA(), this.prngB();
}
random_dec() {
return (this.useA = !this.useA), this.useA ? this.prngA() : this.prngB();
}
random_int($, o) {
return Math.floor($ + (o + 1 - $) * this.random_dec());
}
random_choice($) {
return $[this.random_int(0, $.length - 1)];
}
wRand($) {
let o,
l = 0,
n = this.random_dec();
for (o in $) if (n <= (l += $[o])) return o;
}
})();
var l = {};
return (
(l.layout = o.wRand({
ichi: 0.02,
companion: 0.08,
duo: 0.2,
fountain: 0.7,
})),
(l.nBlob =
"ichi" == l.layout
? 1
: "companion" == l.layout
? o.wRand({ 1: 0.7, 2: 0.3 })
: "duo" == l.layout
? 2
: o.random_int(3, 7)),
(l.monotone = o.wRand({ 0: 0, 1: 1 })),
(l.bg =
-1 != ["ichi", "companion", "duo"].indexOf(l.layout)
? "mountain"
: o.random_choice(["moor", "mountain"])),
(l.bgCol =
-1 != ["ichi", "companion"].indexOf(l.layout)
? ["#222", "#fff", "#111"]
: o.random_choice([
["#1E0E2D", "#07f49e", "#111"],
["#111", "#fff", "#111"],
["#00113D", "#edb144", "#051132"],
])),
l
);
}
var features = calculateFeatures(tokenData);
function setup() {
createCanvas(
(s = min(windowWidth * (16 / 9), windowHeight)) * (9 / 16),
s,
WEBGL
);
for (let $ = 0; $ < nBlob + 1; $++) {
let o = tokenData.hash.slice(2 * $ + 2, 2 * $ + 4);
rarro.push((parseInt(o, 16) % 100) / 100);
}
(gR = (rarr = scaleArray(rarro))[0]),
([dark, light, base] = features.bgCol),
(nBlob = int(features.nBlob)),
(blobs2 = selectBlob(features.layout, rarr, nBlob));
}
function draw() {
background(base), angleMode(DEGREES), blendMode(ADD);
let $ = new Date();
(uD = $.getDate()), (uH = $.getHours()), (uM = $.getMonth()), push();
let o = (0.7 * s) / (0.6 + nBlob),
l = 0.15 * s + o * nBlob;
(firstBlobCol = drawPal(
(initAng = round(300 * gR) % 360),
(monotone = int(features.monotone)),
0,
nCol
)[0][0]),
drawEarth(features.bg, l, (tones = [dark, firstBlobCol])),
fill("#208bff00"),
"companion" == features.layout
? asawa0(nBlob, blobs2, monotone, rarr, uM, o)
: asawa(nBlob, blobs2, monotone, rarr, uM, o),
pop(),
(text = tokenData.hash);
}
function asawa0($, o, l, n, e, b) {
push(),
rotateY(30 * gR),
gR < 0.5 ? rotateY(10 * e) : rotateY(-(10 * e)),
(j = 0),
push(),
asawa($, o, l, n, e, b),
pop(),
(b /= 5),
push();
let t = gR < 0.1 || 2 == $ ? s / 5 : s / 10;
translate(-s / 5, t), asawa($, o, features.monotone, n, e, b), pop(), push();
let a = gR < 0.1 || 2 == $ ? 0 : s / 5;
translate((2 * s) / 5, a),
asawa($, o, features.monotone, n, e, b),
pop(),
pop();
}
function asawa($, o, l, n, e, b) {
push(), translate(0, -s / 2);
let t = 0.15 * s;
for (let a = 0; a < $; a++) {
let _ = n[a] < 0.15 ? 30 * e : n[a] < 0.35 ? -30 * e : 0;
[pal, innerPal] = drawPal(initAng + _, l, a, nCol);
let i = wRand({ slice: 0.75, full: 0.25 }, n[a]),
u = t + b * a;
if ((push(), isPolarBlob(o[a])))
blobbyBifoliumHeart(o, a, 0, u, pal, innerPal, b, e);
else
for (let f = 0; f < 2; f++)
blobby(
f + 0,
u,
o,
a,
pal,
innerPal,
b,
(angIncre = 3),
(dome = i),
n[a],
e
);
pop();
}
}
function blobbyBifoliumHeart($, o, l, n, e, b, t, a) {
push(),
translate(l, n),
(blobi = $[o]),
o > 1 && ($[o - 1] == blob0 || $[o - 1] == blob3) && (a = 0);
for (let _ = 30; _ < 120; _ += 2)
strokeWeight((sw = selectStroke(_))),
push(),
rotateY(-(2 * _)),
stroke(200, 200, 0),
blobi(e, b, o, t, a),
pop();
for (let i = -60; i < 20; i += 2)
strokeWeight((sw = selectStroke(i))),
push(),
rotateY(2 * i),
stroke(e[0]),
blobi(e, b, o, t, a),
pop();
pop();
}
function blobby($, o, l, n, e, b, t, a, _, i, u) {
([ang, span, rot] = drawDome(features.layout, _, i, uH)),
(angLst = [ang, ang + rot]);
let f = Array(nCol).fill(color(200, 200, 0));
pals = gR < 0.09 ? [e, f] : [e, e];
let m = 2;
isPolarBlob(l[n]) && ((rot = 0), (m = 1), (span = 90));
for (let h = 0; h < m; h++)
push(),
rotateY(angLst[h]),
blobLayer(
$ + (xdispAdj = i < 0.25 && l.length > 2 ? t / 16 : 0),
o,
l,
n,
pals[h],
b,
t,
angLst[h],
span,
a,
i,
u
),
pop();
}
function isPolarBlob($) {
return $ == blob7;
}
function selectStroke($) {
return (
(sw = $ % 5 < 2 ? 0.6 : 0.1618),
s > 1600 && (sw *= map(s, 800, 8e3, 1, 6)),
sw
);
}
function blobLayer($, o, l, n, e, b, t, a = 0, _ = 180, i = 2, u, f) {
(f = int(f)), push(), translate($, o);
let m = max(0, f - (randomMonth = int(12 * u))),
h =
5 +
5 * sin(((m + uD / uDmaxTimeRange / 2 + gR / 2) / uMmaxTimeRange) * 90);
rotateX(
0 == n && l.length > 1 ? 0 : u < 0.1 && 0 != n ? h : u < 0.7 ? -h : 0
);
for (let d = 0; d < _; d += i)
stroke(e[d % nCol]),
strokeWeight((sw = selectStroke(d))),
push(),
rotateY(d),
"ichi" == layout && scale(2.88),
(u < 0.3 && !isPolarBlob(blobs2[n]) && l.length > 3) ||
("duo" == features.layout && 0 == n) ||
(3 == l.length && 0 == n)
? (push(),
translate(0, t, 0),
2 == l.length && 0 == n ? scale(0.86, -0.86, 1) : scale(1, -1, 1),
blobs2[n](e, b, d, n, t, u, f),
pop())
: blobs2[n](e, b, d, n, t, u, f),
pop();
pop();
}
function blob0($, o, l, n, e, b = 0.2, t) {
stroke($[l % nCol]), push(), rotateY(20 * n);
let a = 2.68 * (e *= 0.8),
_ = 1.88 * e,
i = 0.03 * e,
u = 1.43 * e;
bezier(0, 0, a, _, i, u, 0, e),
b < 0.2 && n != nBlob - 1
? scale(0.618, 0.9)
: (translate(0, 0.3 * e), scale(0.618)),
b < 0.5 && stroke(o[l % nCol]),
bezier(0, 0, a, _, i, u, 0, e),
b > 0.25 &&
(scale(0.5),
b < 0.5 && stroke($[l % nCol]),
translate(0, e / 2),
bezier(0, 0, a, _, i, u, 0, e)),
pop();
}
function blob1($, o, l, n, e = 200, b, t) {
stroke($[l % nCol]);
let a = (0.3 + 0.6 * b) * e,
_ = b * e * 1.1;
bezier(0, 0, 0, 0, a, _, 0, e);
let i = normaSin((t / uMmaxTimeRange) * 90),
u = i * e * 0.6,
f = i * e * 0.1;
(a = f + i * e * 0.2),
(_ = u + 0.3 * i * e),
push(),
stroke(o[l % nCol]),
scale(0.5, 0.3 + 0.6 * b, 1),
bezier(0, u, f, u, a, _, 0, e),
pop();
}
function blob2($, o, l, n, e = 200, b, t) {
stroke($[l % nCol]), push();
let a = -(0.3 * normaSin((t / uMmaxTimeRange) * 90)) + 0.8,
_ = 0.3 * normaSin((t / uMmaxTimeRange) * 90) + 0.2,
i = e * a,
u = e * (0.2 + 0.4 * b),
f = e * _,
m = u + e * (0.1 * b + 0.2);
bezier(0, 0, i, u, f, m, 0, 0.96 * e),
push(),
b < 0.5 ? (translate(0, 0.2 * e), scale(0.618)) : scale(0.618, 1),
b > 0.5 && stroke(o[l % nCol]),
bezier(0, 0, i, u, f, m, 0, 0.96 * e),
pop(),
push(),
b < 0.5 ? (translate(0, e / 4), scale(0.36)) : scale(0.36, 1),
b > 0.75 && stroke($[l % nCol]),
bezier(0, 0, i, u, f, m, 0, 0.96 * e),
pop(),
b < 0.6 &&
(push(),
b < 0.5 ? (translate(0, 0.275 * e), scale(0.2)) : scale(0.2, 1),
b > 0.75 && stroke($[l % nCol]),
bezier(0, 0, i, u, f, m, 0, 0.96 * e),
pop(),
push(),
b < 0.5 ? (translate(0, 0.295 * e), scale(0.1)) : scale(0.1, 1),
b > 0.75 && stroke($[l % nCol]),
bezier(0, 0, i, u, f, m, 0, 0.96 * e),
pop()),
pop();
}
function blob3($, o, l, n, e = 200, b, t) {
stroke($[l % nCol]);
let a = (0.1 + 1.3 * b) * e,
_ = (0.1 + b) * e,
i = 0.5 * e;
push(), rotateY(25 * n), bezier(0, 0, a, 0, _, i, 0, e);
let u = normaSin(((gR + t) / uMmaxTimeRange) * 90);
translate(0, 0.19 * e),
scale(0.182 * u + 0.2, 0.182 * u + 0.2, 1 * u),
bezier(0, 0, a, 0, _, i, 0, e),
pop();
}
function blob4($, o, l, n, e = 200, b = 0.2, t) {
stroke($[l % nCol]);
let a = e * (0.33 * b + 0.3),
_ = a / 4,
i = a / 3,
u = a / 1;
push(),
bezier(0, 0, a, _, i, u, 0, e),
push(),
scale(
0.618 - 0.15 * sin((t / uMmaxTimeRange) * 90),
0.618 - 0.15 * sin((t / uMmaxTimeRange) * 90),
1
),
stroke(o[l % nCol]),
bezier(0, 0, a, _, i, u, 0, e),
pop(),
translate(0, e * (0.618 - 0.15 * sin((t / uMmaxTimeRange) * 90))),
scale(0.2, 0.382 + 0.15 * sin((t / uMmaxTimeRange) * 90), 1),
stroke(o[(l + 1) % nCol]),
bezier(0, 0, a, _, i, u, 0, e),
pop();
}
function normaSin($) {
return sin($) / 2 + 0.5;
}
function blob5($, o, l, n, e = 200, b = 0.2, t) {
noiseSeed(1);
for (let a = 0; a < 3; a++) {
stroke(0 == a ? $[l % nCol] : o[l % nCol]);
let _ = normaSin(
(max(0, t - (randomMonth = int(12 * b))) / uMmaxTimeRange) * 90
),
i = _ * e * (0.6 + 0.2 * _),
u = a * (_ * e) * 0.01,
f = i + 0.118 * e + _ * e * 0.22 * a,
m = u + e / 8,
h = 0.8 * e - _ * e * 0.5,
d = (u + e / 8 + e) / 2;
bezier(i, u, f, m, h, d, 0, e);
}
}
function blob7($, o, l, n = 200, e) {
push(), rotateY(20 * l);
let b = 1.8,
t = 1;
0 == e ? ((b = 0.88), (t = 1.4)) : (5 == e || e >= 9) && ((b = 1), (t = 1.5)),
1 != t
? (push(), translate(0, n / 2), bifolium(n, b, t), pop())
: bifolium(n, b, t),
pop();
}
function bifolium($, o, l) {
beginShape();
for (let n = 0; n < 90; n += 0.2)
vertex(
(x = (r = $ * o * pow(sin(n), 0.618) * cos(pow(n, l))) * sin(n)),
(y = r * cos(n))
);
endShape();
}
function drawEarth($, o, l) {
push();
let [n, e] = l;
if ((blendMode(BLEND), "moor" == $)) {
beginShape(),
noStroke(),
fill(n),
vertex((-s * (9 / 16)) / 2, o - s / 2),
vertex((s * (9 / 16)) / 2, o - s / 2),
fill(e),
vertex((s * (9 / 16)) / 2, o - s / 2 + s / 28),
vertex((-s * (9 / 16)) / 2, o - s / 2 + s / 28),
endShape(CLOSE),
beginShape();
for (let b = 0; b < 11; b++) {
fill(base);
let t =
o -
s / 2 -
(1.6 * normaSin((frameCount / 2) % 180) + 1) * abs(b - 5) ** 2;
vertex(lerp((-s * (9 / 16)) / 2, (s * (9 / 16)) / 2, b / 10), t + s / 28);
}
vertex((s * (9 / 16)) / 2, o - s / 2),
vertex((-s * (9 / 16)) / 2, o - s / 2),
endShape(CLOSE);
} else if ("mountain" == $) {
beginShape(), noStroke();
for (let a = 0; a < 11; a++) {
fill(n);
let _ = max(
o - s / 2 + s / 32 + (s / 32) * normaSin((frameCount / 2) % 180),
o -
s / 2 +
s / 32 +
(s / 32) * normaSin((frameCount / 8) % 180) +
2 * abs(a - 5) ** 2
);
vertex(lerp((-s * (9 / 16)) / 2, (s * (9 / 16)) / 2, a / 10), _);
}
fill(e),
vertex((s * (9 / 16)) / 2, 0.6 * s),
vertex((-s * (9 / 16)) / 2, 0.6 * s),
endShape();
}
pop();
}
function drawDome($, o, l, n) {
if (!(("slice" == o) & ("ichi" != $)))
return [
-90,
(span = 180 - 60 * sin((n / uHmaxTimeRange) * 90)),
(rot = 180),
];
{
let e = 100 * l + 80;
return [
-60 + 40 * l,
(span = e + (179 - e) * sin((n / uHmaxTimeRange) * 90)),
(rot = 180),
];
}
}
function rand_choice($, o) {
return $[(idx = Math.floor(0 + ($.length - 1 + 1 - 0) * o))];
}
function selectBlob($, o, l) {
if ("ichi" == $) blobs2 = [rand_choice((blobs = [blob1, blob2]), gR)];
else if ("fountain" == $) {
(blobs = [blob0, blob1, blob2, blob3, blob4, blob5, blob7]), (blobs2 = []);
for (let n = 0; n < l; n++) blobs2.push(rand_choice(blobs, o[n]));
} else if ("duo" == $ || ("companion" == $ && 2 == l))
blobs2 = rand_choice(
[
[blob2, blob0],
[blob4, blob0],
[blob5, blob0],
[blob1, blob1],
[blob1, blob3],
[blob1, blob4],
[blob1, blob5],
[blob2, blob2],
[blob2, blob3],
[blob2, blob4],
[blob2, blob5],
[blob3, blob2],
[blob3, blob3],
[blob3, blob4],
[blob3, blob5],
[blob5, blob1],
[blob5, blob2],
[blob5, blob3],
[blob5, blob5],
],
gR
);
else if ("companion" == $)
blobs2 = [rand_choice((blobs = [blob1, blob2, blob4]), gR)];
else {
blobs2 = [];
for (let e = 0; e < 7; e++)
blobs2.push(rand_choice([blob1, blob2, blob3, blob4, blob5], o[e]));
}
return blobs2;
}
function drawPal($, o, l, n) {
return [
(pal = cubeHelixPal(
(n = 10),
abs(
$ -
(colGap =
1 == o
? 15
: gR < 0.46
? map(gR, 0, 1, 20, 36)
: gR < 0.6
? 120
: 180) *
l
) % 360,
-0.35,
0.82,
0.7,
[0.28, 0.8],
0.5
)),
(innerPal = cubeHelixPal(
n,
abs($ - colGap * l + 180) % 360,
-0.35,
0.8,
0.7,
[0.28, 0.8],
0.5
)),
];
}
function cubeHelixPal($, o, l, n, e, b, t) {
let a = [];
for (let _ = 0; _ < $; _++)
(o -= 2 * _),
a.push(color((c = cubeHelix(o, l, n, e, b, t))[0], c[1], c[2]));
return a;
}
function cubeHelix($, o, l, n, e, b) {
($ = void 0 !== $ ? $ : 300),
(o = void 0 !== o ? o : -1.5),
(l = void 0 !== l ? l : 1),
(n = void 0 !== n ? n : 1);
let t = (e = void 0 !== e ? e : [0, 1])[1] - e[0],
a = 2 * Math.PI * ($ / 360 + o * b),
_ = Math.pow(e[0] + t * b, n),
i = (l * _ * (1 - _)) / 2,
u = _ + i * (-0.14861 * Math.cos(a) + 1.78277 * Math.sin(a)),
f = _ + i * (-0.29227 * Math.cos(a) - 0.90649 * Math.sin(a)),
m = _ + i * (1.97294 * Math.cos(a));
return (
(u = Math.floor(255 * Math.max(0, Math.min(1, u)))),
(f = Math.floor(255 * Math.max(0, Math.min(1, f)))),
(m = Math.floor(255 * Math.max(0, Math.min(1, m)))),
[u, f, m]
);
}
function wRand($, o) {
let l,
n = 0;
for (l in $) if (o <= (n += $[l])) return l;
}
function scaleArray($) {
for (
var o = Math.min.apply(null, $), l = Math.max.apply(null, $), n = [], e = 0;
e < $.length;
e++
)
n[e] = ($[e] - o) / (l - o + 1e-7);
return n;
}
function windowResized() {
resizeCanvas((s = min(windowWidth * (16 / 9), windowHeight)) * (9 / 16), s),
redraw();
}
function keyTyped() {
(text = tokenData.hash),
"s" === key
? saveCanvas("sketch_", text + ".png")
: "w" === key &&
(resizeCanvas(((s = 7680) / 16) * 9, s),
redraw(),
saveCanvas("large_sketch.png"));
}