memoscan
← all memos

Memo 0xf5bcfeea…261bee on Ethereum

let x = 0, y = 0.01, a = 2, b = -1.8, c = 1.6, d = 1.6; var cs, nd, layout, angle, showBite, textures, gradient, h, w, gR, fg_cs_dct, rarr = []; function calculateFeatures(e) { fg_cs_dct = { base: ["#F1E9DA", "#FFD400", "#541388", "#D90368", "#2E294E"], flame: ["#e60707", "#c80000", "#FFADAD", "#a20606", "#7b0c00", "#5f0701"], beach: ["#f24088", "#ed555d", "#fd894a", "#ffc12e", "#fff23f"], timhorton: ["#94165c", "#f90062", "#3ec2fa", "#054ba8"], centralpark: ["#490a3d", "#bd1550", "#e97f02", "#f8ca00", "#8a9b0f"], judd: ["#f6bc12", "#1477bb", "#41bb9b", "#ff4242", "#fec101"], autumn: [ "#705f84", "#687d99", "#6c843e", "#fc9a1a", "#dc383a", "#aa3a33", "#9c4257", ], olympia: ["#ff3250", "#ffb33a", "#008c36", "#0085c6", "#4c4c4c"], comets: ["#FFA0FF", "#0364FC", "#41CA7C", "#FDBC28", "#9EA1F8"], lajolla: ["#EFE5D1", "#F09BC4", "#F54034", "#1F43B1", "#02ADDC"], cranberrysauce: ["#ffbbee", "#cc3300", "#7799dd", "#991100", "#6600bb"], candiedapple: ["#e8165b", "#401e38", "#66c3b4", "#ee7724", "#584098"], frozenrose: ["#29368f", "#e9697b", "#1b164d", "#f7d996"], lego: ["#f1594a", "#f5b50e", "#14a160", "#2969de", "#4c4c4c"], amaretto: [ "#811e18", "#4c6216", "#c88a2c", "#9e4013", "#b04948", "#1a472a", ], choco: ["#8d1c06", "#e67424", "#f5c34d", "#3c0d03", "#ed9b49"], irishcream: [ "#ef8a47", "#376795", "#f7aa58", "#72bcd5", "#e76254", "#1e466e", "#ffd06f", "#528fad", ], Marfa: [ "#792504", "#527baa", "#bc7524", "#8dadca", "#082844", "#421600", "#104839", ], koloocheh: [ "#8cc8bc", "#b83326", "#7da7ea", "#1d4497", "#c8570d", "#5773c0", "#edb144", "#dd7867", ], bonito: [ "#b36c06", "#65150b", "#c0431f", "#f19425", "#961f1f", "#533d14", "#c59349", ], mixedberry: [ "#2f357c", "#b0799a", "#e69b00", "#355828", "#6c5d9e", "#bf3729", "#e48171", "#f5bb50", "#9d9cd5", "#17154f", "#f6b3b0", "#ada43b", ], pistachio: [ "#ba5c3f", "#307d7f", "#598c4c", "#a13213", "#042e4e", "#470c00", ], edibleflower: ["#eab1c6", "#e18a1f", "#d35e17", "#829d44", "#e9b109"], dango: [ "#4457a5", "#c44d76", "#7caf5c", "#59386c", "#b24422", "#13315f", "#447861", "#b1a1cc", ], honey: [ "#802417", "#c06636", "#17486f", "#e8b960", "#ce9344", "#646e3b", "#508ea2", "#2b5851", ], bluecorn: [ "#6c1d0e", "#235070", "#c27668", "#7ba0b4", "#421401", "#0a2d46", "#8b3a2b", "#44728c", ], lavendar: [ "#2673a3", "#582310", "#473d7d", "#318f49", "#582310", "#0cb4bb", "#82c45f", ], cremebrulee: [ "#bd3106", "#5b7314", "#454b87", "#d9700e", "#89a6bb", "#eebe04", "#c3d6ce", "#e9a00e", ], forest: ["#7c291e", "#ba7233", "#2d5380", "#3a4421", "#4b1d0d"], }; let t = new (class { constructor() { this.useA = !1; let t = function (e) { let t = parseInt(e.substr(0, 8), 16), a = parseInt(e.substr(8, 8), 16), i = parseInt(e.substr(16, 8), 16), n = parseInt(e.substr(24, 8), 16); return function () { (t |= 0), (a |= 0), (i |= 0), (n |= 0); let e = (((t + a) | 0) + n) | 0; return ( (n = (n + 1) | 0), (t = a ^ (a >>> 9)), (a = (i + (i << 3)) | 0), (i = (i << 21) | (i >>> 11)), (i = (i + e) | 0), (e >>> 0) / 4294967296 ); }; }; (this.prngA = new t(e.hash.substr(2, 32))), (this.prngB = new t(e.hash.substr(34, 32))); for (let e = 0; e < 1e6; e += 2) this.prngA(), this.prngB(); } random_dec() { return (this.useA = !this.useA), this.useA ? this.prngA() : this.prngB(); } random_int(e, t) { return Math.floor(e + (t + 1 - e) * this.random_dec()); } random_choice(e) { return e[this.random_int(0, e.length - 1)]; } wRand(e) { let t, a = 0, i = this.random_dec(); for (t in e) if (((a += e[t]), i <= a)) return t; } })(); var a = Object.keys(fg_cs_dct), i = {}; return ( (i.palette = t.random_choice(a)), (i.nd = t.random_dec() < 0.04 ? 1 : t.random_dec() < 0.08 ? 3 : t.random_dec() < 0.16 ? 2 : t.random_int(4, 10)), (i.bg = t.random_choice(["#222", "#00113D"])), (i.textures = t.random_dec() < 0.2 ? "original-mochi" : t.random_choice([ "original", "waffle", "satellite", "oldFashioned", "original-oldFashioned", "original-satellite", "mochi-satellite", "mochi-oldFashioned", "oldFashioned-waffle", ])), (i.fillType = t.wRand({ original: 0.2, gradient: 0.5, rim: 0.3 })), (i.layout = 1 == i.nd ? "uno" : 2 == i.nd ? t.random_choice(["stack", "cairn"]) : 3 == i.nd && -1 != ["oldFashioned", "satellite"].indexOf(i.textures) ? "radiate" : -1 != ["original", "waffle", "satellite", "mochi", "oldFashioned"].indexOf( i.textures ) ? t.wRand({ stack: 0.15, melt: 0.15, radiate: 0.7 }) : 3 == i.nd ? "stack" : t.wRand({ stack: 0.7, grow: 0.3 })), i ); } var features = calculateFeatures(tokenData); function setup() { pixelDensity(2), (h = windowHeight), (w = (9 * h) / 16), createCanvas(w, h), (nd = features.nd); for (let e = 0; e < nd; e++) { let t = tokenData.hash.slice(2 * e + 2, 2 * e + 4); rarr.push((parseInt(t, 16) % 100) / 100); } (gR = rarr[0]), (angle = TAU * gR), noiseSeed(gR), (showBite = gR > 0.08), (initCol = fg_cs_dct[features.palette]), (cs = gR > 0.5 ? initCol : initCol.reverse().slice(0, 4)), (layout = features.layout), (textures = features.textures), (fillType = features.fillType), (gradient = features.gradient), (donut = new Donut( a, b, c, d, nd, cs, textures, fillType, (half = "all"), (dilute = "no"), rarr )), noStroke(), background(features.bg); } function draw() { (curtainCall = 9), frameCount > curtainCall && noLoop(), "cairn" == layout ? (donut.calc(), donut.show("cairn")) : donut.show(layout); } function calcSize(e, t) { return e > 3 ? (0.8 * h) / e / t / 3 : (0.8 * h) / e / t / 4; } function calcD(e, t = 0.8) { return (e > 3) & (gR > t) ? 2.7 : 1.6; } function calcVarSize(e, t, a, i = 0.05) { return gR > i || 2 == e ? a * map(noise(t), 0, 1, 0.8, 1.35) : a; } function calcBite(e, t, a) { return e & ((a > 3) & (a < t - 2) || (2 == t) & (gR > 0.5)) ? 1 + a / 4 : 0; } function calcYpos(e, t, a) { return e > 2 ? 0.05 * t + ((0.8 * t) / e) * (1 + a) : 0.05 * -t + ((0.8 * t) / e) * (1 + a); } function keyTyped() { "s" === key && saveCanvas("TOT.png"); } function textureRec(e, t, a, i, n, s, s) { if ("waffle" == e) return ( !!((dist(t, a, 0, 0) < 2.3) & (dist(t, a, 0, 0) > 1)) && ((g = s < 15 ? int(((i - t) * s) / 10) % 2 == 0 ? 1 : 0.5 : int(((i - t) * s) / 10) % 2 == 0 ? 2.8 : 0.9), !((abs(int((i - t) * s) % 10) > g) & (abs(int((n - a) * s)) % 10 > g))) ); if ("satellite" == e) { let e = 3 * gR; return ( (a / t > -0.05 + e) & (a / t < 0.25 + e) || (a / t > 1.5 + e) & (a / t < 2 + e) || (a / t > 5 + e) & (a / t < 6 + e) ); } if ("mochi" == e) { let e = dist(0, 0, t, a), i = atan2(a, t + 1e-4); return ( (e > 2 + 0.5 * abs(cos((9 * i) / 2))) | (e < 1.18 - 0.2 * abs(cos((9 * i) / 2))) ); } if ("oldFashioned" == e) { let e = atan2(a, t + 1e-4), i = 1.86 + abs(cos(4 * e)) / 2 + abs(cos(5 * e)) / 2; return dist(0, 0, t, a) > i; } return !1; } function fillByType(e, t, a, i, n, s, r) { if ("original" == s) fill(i); else if ("gradient" == s) { let e = constrain(map(t, -a, a, 0, 1), 0, 1); fill(lerpColor(color(i), color(n), e)); } else if ("rim" == s) { let s = gR > 0.5 ? (a * cos(r)) / 2 : 0, c = map(dist(e, t, s, 0) / a, 0, 1, 0, 0.618); fill(lerpColor(color(i), color(n), c)); } } function doeDilute(e, t, a, i, n, s, r, c, o, l, d, f, h, u, b, g = "all", p) { let w = "on" == b ? 2 : 1; for (let b = 0; b < w; b++) { (currD = ("flat" == p) & (1 == b) ? 2.7 : s), doe( e, t, a, i, n, currD, 0 == b ? r : c, o, l, d, f, h, u, g, 0 == b ? "no" : "yes" ); } } function doe( e, t, a, n, s, r, c, o, l = "#fff", d, f, u, b, g = "all", p = "no" ) { push(), translate(e, t), noStroke(); let m = h < 300 ? int(pow(5.2 * c, 2)) : h < 500 ? int(pow(3.95 * c, 2)) : h < 770 ? int(pow(3.6 * c, 2)) : h < 3e3 ? int(pow(2 * c, 2)) : int(pow(c, 2)); for ( maxIter = m, "yes" == p && (maxIter = m / 10), "mochi" == u && (maxIter = 1.1 * m), "cairn" == layout && (maxIter = 2 * m), i = maxIter; i > 0; i-- ) { (newx = r * sin(a * x) - sin(n * y)), (newy = s * cos(a * x) + cos(n * y)), (x = newx), (y = newy), fillByType(x, y, s, o, l, b, f), blendMode(ADD); let i = (d > 0) & (s == r) & (dist(x, y, 1.8 * s * cos(f), 1.8 * s * sin(f)) < 3 * max(0.5, gR)), p = ("left" == g) & (x > 0) || ("right" == g) & (x < 0), m = 1 ==