memoscan
← all memos

Memo 0x16bac62a…0a390c on Ethereum

let SAVEFRAMES=!1,myWidth=1152,myHeight=1600,halfWidth=myWidth/2,halfHeight=myHeight/2,drawWidth,drawHeight,currentFrame=0,currentHash="",buffer,bg,mg,fov,maxDist,minDist,eyeHeight,horizon_y,pathPts=[],things=[],portals=[],spireTips=[],numPalettes,palette_id,palettes=[],sunPalettes=[],cs=[],sunCs=[],cumulativeChances=[],GROUND,PALETTE,PALETTES=["Teal Rust","Crimson Sun","Brown/Barren","Deep Purple","Red Moon","Faded Nature","Slate Salmon","Grayscale","Sepia","Sharp Verdant","Peach Slate","Worn Viridescence","Mars/Dusk","White Void","Red Contrast","Blue Contrast","Sunset","Slate Ice"],SUN_TYPE,SUN_TYPES=["ABSENT","EXPECTED","EXAGGERATED","BLACK"],STAR_TYPE,STAR_TYPES=["OBSCURED","NIGHT SKY","SHOOTING STARS","FALLING STARS","LAPSED","MISSING"],PORTAL_TYPE,PORTAL_TYPES=["FULL CIRCLE","FULL TRIANGLE","FULL DOORWAY","CIRCULAR INTERFACE","MYSTICAL CIRCLE","COMPLEX PORTAL","PORTAL TRIANGLE","MISSING"],PORTAL_GLOW,PORTAL_GLOWS=["INVITING","STURDY"],nearestPortalZ,PATH_TYPE,PATH_TYPES=["OVERGROWN","MEANDERING","DIRECT"],MEMORY_TYPE,MEMORY_TYPES=["CREEPING FOG","PARTIAL RECOLLECTION","CONNECTED"],MIDGROUND_COPSE,MIDGROUND_HILLS,MIDGROUND_MEGALITHS,MIDGROUND_SPIRES,FORGETTING_TREES,FORGETTING_SPIRES,sun_size,sun_y,eclipse,haziness,cloudiness,cloudGlow,skyGlow,rockChance,grassChance,spikyChance,flowerChance,pixelDensityOrig,xnoff,ynoff;function genTokenData($){let e={},t="0x";for(var r=0;r<64;r++)t+=Math.floor(16*Math.random()).toString(16);return e.hash=t,e.tokenId=(1e6*$).toString(),currentHash=t,e}class Random{constructor(){this.useA=!1;let $=function($){let e=parseInt($.substr(0,8),16),t=parseInt($.substr(8,8),16),r=parseInt($.substr(16,8),16),n=parseInt($.substr(24,8),16);return function(){r|=0;let $=((e|=0)+(t|=0)|0)+(n|=0)|0;return n=n+1|0,e=t^t>>>9,t=r+(r<<3)|0,r=(r=r<<21|r>>>11)+$|0,($>>>0)/4294967296}};this.prngA=new $(tokenData.hash.substr(2,32)),this.prngB=new $(tokenData.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_num($,e){return $+(e-$)*this.random_dec()}random_int($,e){return Math.floor(this.random_num($,e+1))}random_bool($){return this.random_dec()<$}random_choice($){return $[this.random_int(0,$.length-1)]}}function loadPalettes(){append(sunPalettes,[.56,.96,1,.63,1,1]),append(sunPalettes,[.84,.11,.13,1,.25,.05]),append(sunPalettes,[.97,.95,.65,1,.98,.75]),append(sunPalettes,[.98,.87,.8,1,1,1]),append(sunPalettes,[.77,.27,.2,1,.35,.2]),append(sunPalettes,[.95,.85,.75,1,1,.92]),append(sunPalettes,[.9,.72,.62,1,.88,.8]),append(sunPalettes,[.9,.9,.9,1,1,1]),append(sunPalettes,[.8,.67,.51,.98,.88,.73]),append(sunPalettes,[.99,.99,.64,1,1,1]),append(sunPalettes,[.85,.58,.46,.94,.84,.66]),append(sunPalettes,[.75,.86,.72,.95,.97,.82]),append(sunPalettes,[.98,.87,.7,1,.92,.78]),append(sunPalettes,[1,1,1,1,1,1]),append(sunPalettes,[.85,0,0,1,0,0]),append(sunPalettes,[0,0,.85,0,0,1]),append(sunPalettes,[.97,.97,.78,1,1,.95]),append(sunPalettes,[.8,.92,.95,1,1,1]),append(palettes,[.16,.11,.05,.24,.16,.08,.4,.25,.14,.58,.35,.22]),append(palettes,[.01,.05,.11,.2,.06,.06,.45,.09,.09,.75,.16,.16]),append(palettes,[0,0,.08,.25,.12,.31,.55,.31,.27,.87,.72,.51]),append(palettes,[.04,.01,.03,.14,.04,.22,.31,.38,.4,.98,.83,.75]),append(palettes,[.02,.03,.05,.11,.12,.16,.22,.23,.28,.3,.31,.35]),append(palettes,[.05,.08,.12,.2,.25,.32,.3,.38,.48,.6,.55,.5]),append(palettes,[.04,.05,.1,.22,.28,.35,.35,.42,.52,.68,.62,.55]),append(palettes,[.11,.11,.11,.25,.25,.25,.44,.44,.44,.66,.66,.66]),append(palettes,[.3,.11,0,.47,.2,.04,.52,.4,.22,.8,.67,.51]),append(palettes,[.23,.15,.18,.25,.26,.55,.33,.74,.49,.85,.99,.78]),append(palettes,[.23,.15,.18,.2,.23,.26,.24,.28,.31,.5,.49,.42]),append(palettes,[.02,.16,.04,.26,.49,.28,.47,.67,.36,.57,.77,.66]),append(palettes,[.19,.14,.17,.42,.2,.16,.69,.32,.18,.89,.58,.32]),append(palettes,[.22,.22,.22,.65,.65,.65,.83,.83,.83,1,1,1]),append(palettes,[0,0,0,.05,.05,.25,.15,.2,.4,.2,.2,.8]),append(palettes,[0,0,0,.25,0,0,.4,0,0,.8,0,0]),append(palettes,[.14,.06,.3,.37,.07,.46,.82,.2,.46,.97,.5,.33]),append(palettes,[.07,.16,.19,.18,.32,.35,.27,.44,.55,.49,.68,.75]),numPalettes=palettes.length}function createColors($){let e=sunPalettes[$],t=palettes[$];cs=[];for(let r=0;r<4;r++){let n=3*r,o=t[n+0],l;append(cs,color(o,t[n+1],t[n+2]))}sunCs=[];for(let a=0;a<2;a++){let i=3*a,_=e[i+0],d;append(sunCs,color(_,e[i+1],e[i+2]))}}function getSunColor($,e){let t=lerpColor(sunCs[0],sunCs[1],$);return void 0!==e?color(red(t),green(t),blue(t),e):t}function getGroundColor($,e){let t=GROUND;void 0!==e&&(t+=e);let r=getColor(t),n=getColor(t+.05),o=map($,maxDist,minDist,0,1,!0);return lerpColor(r,n,pow(o,8))}function getColor($,e){let t,r;for(let n=0;n<3;n++)if($<=(n+1)*.3334){t=map($,.3334*n,(n+1)*.3334,0,1),r=lerpColor(cs[n],cs[n+1],t);break}return void 0!==e?color(red(r),green(r),blue(r),e):r}function getRandomColor(){return color(R.random_dec(),R.random_dec(),R.random_dec())}function getNoise($,e,t){return map(noise($*t+xnoff,e*t+ynoff),0,1,0,1,!0)}function findIntersection($,e,t,r,n){return[$+(n-e)*(t-$)/(r-e),n]}function findCircleLineIntersection($,e,t,r){let n=Math.abs(r-e);if(n>t)return null;if(n===t)return[{x:$,y:r}];{let o=Math.sqrt(t*t-n*n);return[{x:$+o,y:r},{x:$-o,y:r}]}}function drawGradient($,e,t,r,n,o,l,a,i,_){let d=min(r,n),s=max(r,n);$.strokeWeight(i+_);for(let u=d;u<s;u+=i){let m=pow(map(u,d,s,0,1,!0),a);$.stroke(lerpColor(o,l,m)),$.line(e,u,t,u)}$.noStroke()}function drawGradientLine($,e,t,r,n,o,l,a){let i=dist(e,t,r,n)/20;$.strokeWeight(a);for(let _=0;_<i;_++){let d=map(_,0,i,0,1),s=lerp(e,r,d),u=lerp(t,n,d),m=lerpColor(o,l,d);$.stroke(m),$.line(s,u,s,u+20)}}function drawGradientRect($,e,t,r,n,o,l,a,i,_){let d=ceil(abs(r-e)/_);0==a&&(d=ceil(abs(n-t)/_));for(let s=0;s<d-1;s++){let u=map(s,0,d-1,0,1,!0),m=map(s+1,0,d-1,0,1,!0),f,h;0==a?(f=ceil(lerp(t,n,u)),h=ceil(lerp(t,n,m))):(f=ceil(lerp(e,r,u)),h=ceil(lerp(e,r,m)));let g=lerpColor(o,l,pow(u,i));$.fill(g),$.beginShape(),0==a?($.vertex(e,f),$.vertex(e,h),$.vertex(r,h),$.vertex(r,f)):($.vertex(f,t),$.vertex(h,t),$.vertex(h,n),$.vertex(f,n)),$.endShape()}}function drawGradientCircle($,e,t,r,n,o,l){$.strokeWeight(1.5);let a=r*r;for(let i=-r;i<=r;i++){let _=int(t)+i,d=map(i,-r,r,0,1),s=lerpColor(n,o,d);$.stroke(s);let u=sqrt(a-i*i);$.line(e-u,_,e+u,_)}$.noStroke()}function drawRadialGradient($,e,t,r,n,o,l,a,i){$.noFill(),$.strokeWeight(i);let _,d,s,u;r<=n?(_=r,d=n,s=o,u=l,a=1/a):(_=n,d=r,s=l,u=o);for(let m=_;m<d;m+=i){let f=pow(map(m,_,d,0,1),a);$.stroke(lerpColor(s,u,f)),$.circle(e,t,m)}$.noStroke()}function drawEllipseGradient($,e,t,r,n,o,l,a,i,_){$.noStroke();for(let d=n;d>=r;d-=_){let s=pow(map(d,r,n,0,1),i);$.fill(lerpColor(l,a,s)),$.ellipse(e,t,d,d/o)}}function drawBrokenLine($,e,t,r,n,o,l,a,i,_,d){let s=dist(e,t,r,n),u=atan2(n-t,r-e),m=e,f=t;for(;dist(m,f,r,n)>a;){let h=R.random_num(.001*a,a),g=dist(m,f,r,n)/s,c=m+cos(u)*h,p=f+sin(u)*h;if(h<dist(m,f,r,n)){let x=lerpColor(o,l,g);_&&$.strokeWeight(d*sin(g*PI)),$.stroke(x),$.line(m,f,c,p)}let S=R.random_num(i/2,i);m+=cos(u)*(h+S),f+=sin(u)*(h+S)}(m!==r||f!==n)&&$.line(m,f,r,n)}function drawArc($,e,t,r,n,o,l,a){$.beginShape();for(let i=0;i<=a;i++){let _=lerp(o,l,i/a),d=e+n*cos(_),s=t+n*sin(_);$.vertex(d,s)}for(let u=a;u>=0;u--){let m=lerp(o,l,u/a),f=e+r*cos(m),h=t+r*sin(m);$.vertex(f,h)}$.endShape(CLOSE)}function drawPolygon($,e,t,r,n,o,l){let a=[],i=TWO_PI/e,_=-HALF_PI;l&&(_+=i/2);let d=t+cos(_-i)*n,s=r+sin(_-i)*n;for(let u=0;u<e;u++){let m=t+cos(_)*n,f=r+sin(_)*n;drawBrokenLine($,m,f,d,s,o,o,50,10,!1,1),a.push({x:m,y:f}),_+=i,d=m,s=f}return a}function getPointOnPolygon($,e){let t=-1;if(-1===t){t=0;for(let r=0;r<$.length;r++)t+=dist($[r].x,$[r].y,$[(r+1)%$.length].x,$[(r+1)%$.length].y)}let n=t*e,o=0;for(let l=0;l<$.length;l++){let a=dist($[l].x,$[l].y,$[(l+1)%$.length].x,$[(l+1)%$.length].y);if(o+a>=n){let i=(n-o)/a,_;return{x:$[l].x+i*($[(l+1)%$.length].x-$[l].x),y:$[l].y+i*($[(l+1)%$.length].y-$[l].y)}}o+=a}return null}function getLighting($,e,t){let r=0;for(let n of portals){let o=n.x;n.y;let l=n.z,a=n.d,i=dist($,4*t,o,4*l),_=map(i,50,1400,3.5*a,1*a,!0),d=pow(map(i,.1*_,_,1,0,!0),3);r+=d}return r=constrain(r,0,1),4==PORTAL_TYPE&&(r*=.5),PORTAL_GLOW||(r=0),r}function getZ($){return(eyeHeight*fov+horizon_y*fov-$*fov)/($-horizon_y)}function getY($,e){return eyeHeight*(fov/(fov+e))+horizon_y}function easeInOutSine($,e,t,r){return-t/2*(cos(PI*$/r)-1)+e}function createPath(){let $=R.random_num(0,13);for(let e=0;e<1e4;e++){let t=map(e,0,9999,0,1),r=map(sqrt(t),0,1,maxDist,minDist),n=map(r,maxDist,minDist,0,1),o=fov/(fov+r),l=eyeHeight*o+horizon_y,a=(650*sin(.01*r+$)+200*getNoise(n,l,.005))*o*n+halfWidth,i=abs(nearestPortalZ-r),_=map(i,0,200,0,1,!0);_=easeInOutSine(_,0,1,1),a=lerp(halfWidth,a,_);let d=o*R.random_num(20,40);2==PATH_TYPE&&(a=halfWidth),pathPts.push({x:a,y:l,z:r,w:d,zper:n*o})}}function getPath($){let e=0,t=abs(pathPts[0].y-$);for(let r=1;r<pathPts.length;r++){let n=abs(pathPts[r].y-$);if(n>t)break;t=n,e=r}return pathPts[e]}function drawPath($){if(0!=PATH_TYPE){let e=portals[portals.length-1].y,t=myHeight;$.noStroke();for(let r=0;r<200;r++){let n=map(r,0,199,0,1),o=map(n,0,1,e,t),l=getPath(o),a=l.x,i=l.z,_=l.w,d=l.zper,s=getGroundColor(i),u=portals[0].z;s=lerpColor(getSunColor(0,.3),s,d*d);let m=map(abs(i-u),0,600,2.5,0);drawBrokenLine($,a-7*_,o,a+7*_,o,s,s,15,3,!0,m),$.noStroke()}$.noStroke()}}function getId(){let $=R.random_dec();for(let e=0;e<cumulativeChances.length;e++)if($<cumulativeChances[e])return e+1;return 1}function createThings($){for(let e=0;e<$;e++){let t=getId(),r=pow(R.random_num(.25,1),.5),n=map(r,0,1,maxDist,minDist);r=pow(r,6);let o=fov/(fov+n),l=-100;for(;l<0||l>myWidth;)l=R.random_num(-15e3,15e3)*o+halfWidth;let a=getY(l,n);things.push({id:t,type:0,x:l,y:a,z:n,s:o,zper:r})}{let i=1;PORTAL_TYPE>=3&&PORTAL_TYPE<7&&(i=R.random_bool(.02)?2:1);let _=[nearestPortalZ,nearestPortalZ+500];for(let d=0;d<i;d++){let s=halfWidth,u=_[d],m=getY(s,u),f=map(u,200,1e3,R.random_num(350,1e3),50);7==PORTAL_TYPE&&(f=350);let h=f*R.random_num(.02,.05);things.push({id:0,type:PORTAL_TYPE,x:s,y:m,z:u,d:f,w:h}),portals.push({id:d,type:PORTAL_TYPE,x:s,y:m,z:u,d:f,w:h})}}if(MIDGROUND_COPSE){let g=R.random_int(150,355),c=lerp(minDist,maxDist,.7),p=lerp(minDist,maxDist,.4),x=R.random_num(-300,200);for(let S=0;S<g;S++){let P=R.random_dec(),y=map(P,0,1,c,p);P=pow(P,6);let T=fov/(fov+y),C=-1e3;for(;C<x||C>myWidth-x;)C=R.random_num(-15e3,15e3)*T+halfWidth;let G=getY(C,y);.4>getNoise(C,3*y,.003)&&things.push({id:5,type:0,x:C,y:G,z:y,s:T,zper:P})}}if(MIDGROUND_MEGALITHS){let E=R.random_int(3,5),v=150,O=1200;for(let w=0;w<E;w++){let D=map(w,0,E-1,0,1),L=map(D,0,1,v,O);D=pow(D,6);let k=fov/(fov+L),A=halfWidth,z=getY(A,L);things.push({id:6,type:0,x:A,y:z,z:L,s:k,zper:D})}}if(MIDGROUND_SPIRES){let N=R.random_int(6,14);R.random_bool(.25)&&(N*=3);let W=lerp(minDist,maxDist,.7),I=lerp(minDist,maxDist,.3);for(let b=0;b<N;b++){let Y=map(b,0,N-1,0,1),U=map(Y,0,1,W,I);Y=pow(Y,6);let M=fov/(fov+U),V=R.random_num(-250,myWidth+250),H=getY(V,U);things.push({id:7,type:0,x:V,y:H,z:U,s:M,zper:Y})}}PATH_TYPE>0&&(things=things.filter($=>{let e=!0,t=$.id,r=getPath($.y),n=abs(r.x-$.x);return t>0&&t<=4?(n<6*r.w&&(e=!1),2==t&&n<14.5*r.w&&(e=!1),2==t&&.35>getNoise($.x,3*$.z,.003)&&e&&(e=!1)):5==t&&n<6*r.w&&(e=!1),e}));let F=getY(halfWidth,nearestPortalZ);7==PORTAL_TYPE&&(things=things.filter($=>{let e=!0,t=$.id;return dist($.x,7*$.y,halfWidth,7*F)<.35*myWidth&&0!=t&&(e=!1),e})),things.sort(($,e)=>e.z-$.z)}function drawThings($){for(let e of things){let t=e.id;0==t?drawPortal($,e):1==t?drawGrass($,e):2==t?drawSpikyPlant($,e):3==t?drawRock($,e):4==t?drawFlower($,e):5==t?drawTree($,e):6==t?drawMegalith($,e):7==t&&drawSpire($,e)}}function drawGrass($,e){let t=e.x,r=e.y,n=e.z,o=e.s,l=e.zper,a=getLighting(t,r,n),i=R.random_num(70,105),_=i;R.random_bool(.02)&&(i*=R.random_num(1.4,2.8),_*=R.random_num(1.4,2.8));let d=.25*sin(a*a*PI);i*=d+o,_*=d+o;let s=getGroundColor(n),u=getColor(GROUND),m=getColor(GROUND+R.random_num(.05,.13)),f=lerpColor(s,u,l),h=lerpColor(s,m,l);f=lerpColor(f,getSunColor(0),.85*a),h=lerpColor(h,getSunColor(R.random_dec()),a);let g=max(7,int(.1*i));$.fill(h),$.beginShape(),$.vertex(t-.5*i,r);for(let c=0;c<g;c++){let p=map(c,0,g-1,0,1),x=sin(p*PI),S=map(p,0,1,t-.5*i,t+.5*i),P=map(p,0,1,t-i,t+i),y=r-x*i*.25,T=r-_*(.5*x+.5),C=lerp(y,T,R.random_dec()),G=R.random_num(-.2,.2)*i;$.quadraticVertex(P+G,C,P,T),$.quadraticVertex(P+G,C,S,y)}$.vertex(t+.5*i,r),$.endShape(CLOSE),r+=.15*i,$.fill(f),$.beginShape(),$.vertex(t-.5*i,r);for(let E=0;E<g;E++){let v=map(E,0,g-1,0,1),O=sin(v*PI),w=map(v,0,1,t-.5*i,t+.5*i),D=map(v,0,1,t-.8*i,t+.8*i),L=r-O*i*.25,k=r-_*(.5*O+.5)*.6,A=lerp(L,k,R.random_dec()),z=R.random_num(-.2,.2)*i;$.quadraticVertex(D+z,A,D,k),$.quadraticVertex(D+z,A,w,L)}$.vertex(t+.5*i,r),$.endShape(CLOSE),$.noStroke()}function drawBlade($,e,t,r,n,o){let l=r*(.5*o+.5);R.random_bool(.05)&&(l*=2.5);let a=(n-.5)*65+R.random_num(-(.5*r),.5*r),i=.5*l,_=R.random_num(15,25)*n,d=t+3*o+R.random_num(-10,10)*o;$.vertex(e,d),$.quadraticVertex(e,t-i,e+1.5*a,t-l),$.quadraticVertex(e,t-i,e+_,t)}function drawSpikyPlant($,e){let t=e.x,r=e.y,n=e.z,o=e.s,l=e.zper,a=getLighting(t,r,n),i=R.random_num(20,40),_=i;R.random_bool(.02)&&(i*=1.1,_*=1.4);let d=r-.5*_,s=getGroundColor(n),u=lerpColor(s,getColor(GROUND+.04),l),m=lerpColor(s,getColor(GROUND+.08),l);lerpColor(s,u,l),lerpColor(s,m,l),$.noStroke();let f=R.random_int(5,9);for(let h=0;h<5;h++){let g=map(h,0,4,0,1,!0),c=h%2*(TWO_PI/(2*f)),p=map(g,0,1,i,.1*i,!0),x=lerpColor(u,m,g);x=lerpColor(x,getSunColor(0),a*R.random_num(.6,1));for(let S=0;S<f;S++){let P=map(S,0,f-1,0,1,!0),y=map(P,0,1,.65*PI,2.35*PI)+c+R.random_num(-.2,.2,!0),T=cos(y),C=sin(y),G=t+T*i,E=d+C*p,v=R.random_num(25,35)*o;h<1&&($.stroke(getColor(GROUND+.1,.2)),$.strokeWeight(l)),$.fill(x),$.beginShape(),$.vertex(t,r),$.bezierVertex(t-C*v,r+T*v,G,E,G,E),$.bezierVertex(G,E,t+C*v,r-T*v,t,r),$.endShape()}}$.noStroke()}function drawRock($,e){let t=e.x,r=e.y,n=e.z,o=e.s;t+=map(getNoise(t,n,.01),0,1,-200*o,600*o);let l=e.zper,a=getLighting(t,r,n),i=50*pow(R.random_dec(),2)+5,_=i*R.random_num(.7,1.6);R.random_bool(.005)&&(i*=R.random_num(1.5,2.5),_*=R.random_num(1.5,2.5)),i*=o,_*=o;let d=getGroundColor(n),s=d,u=getColor(GROUND+R.random_num(.2,.25)),m=getColor(GROUND+.15),f=getColor(GROUND-.05),h=lerpColor(s,u,l),g=lerpColor(s,m,l),c=lerpColor(s,f,l);h=lerpColor(h,getSunColor(0),.75*a),g=lerpColor(g,getSunColor(0),.5*a),c=lerpColor(c,g,a);let p=35,x=[];for(let S=0;S<p;S++)if(R.random_bool(.75)){let P=map(S,0,p-1,0,1),y=sin(P*PI),T=map(P,0,1,HALF_PI,TWO_PI+HALF_PI),C=cos(T),G=.5*sin(T)-.5,E=t+C*i*R.random_num(.9,1.1),v=r+G*_*R.random_num(.9,1.1)*y;x.push({x:E,y:v})}p=x.length,$.fill(getColor(.1,.2)),$.beginShape();for(let O=0;O<p;O++){let w=x[O],D=w.x,L=w.y;O>2&&O<p-2&&(L+=(e.y-L)*1.5),$.vertex(D,L)}$.endShape(),$.fill(g),$.beginShape();for(let k=0;k<p;k++){let A=x[k],z=A.x,N=A.y;$.vertex(z,N)}$.endShape(),$.fill(h),$.beginShape();for(let W=8;W<p-8;W++){map(W,0,p-1,0,1);let I=x[W],b=I.x,Y=I.y;$.vertex(b,Y)}$.endShape(),$.fill(c),$.beginShape();for(let U=0;U<5;U++){map(U,0,p-1,0,1);let M=x[U],V=M.x,H=M.y;$.vertex(V,H)}for(let F=p-5;F<p;F++){map(F,0,p-1,0,1);let B=x[F],q=B.x,Z=B.y;$.vertex(q,Z)}$.endShape(),$.noStroke()}function drawFlower($,e){drawDaisy($,e)}function drawDaisy($,e){let t=e.x,r=e.y,n=e.z,o=e.s,l=e.zper,a=getLighting(t,r,n),i=R.random_num(25,35),_=R.random_num(55,85);R.random_bool(.01)&&(i*=1.3,_*=3);let d=.5*a;i*=d+o,_*=d+o;let s=0;for(let u of portals){let m=dist(t,6*n,u.x,6*u.z);s=max(s,m)}let f=map(s,0,2e3,1,0,!0);if(R.random_dec()<f){let h=getGroundColor(n),g=getColor(1);h=lerpColor(h,getColor(.7),a),g=lerpColor(g,getSunColor(1),a),PORTAL_GLOW||(g=lerpColor(getGroundColor(n),getColor(.6),a));let c=R.random_int(1,5);for(let p=0;p<c;p++){let x=t+R.random_num(-50,50)*l,S=r+R.random_num(-44,44)*l,P=i*R.random_num(.75,1.25),y=_*R.random_num(.75,1.25),T=.5*R.random_num(-P,P),C=x+T,G=S-y;$.noFill(),$.stroke(color(red(h),green(h),blue(h),.3)),$.strokeWeight(.05*P),$.beginShape(),$.vertex(x,S),$.bezierVertex(x,S,x-T,lerp(S,G,.5),C,G),$.endShape(),$.noStroke(),$.fill(g);let E=P*R.random_num(.5,.8),v=.25*E,O=R.random_num(.8,1),w=R.random_num(.4,.8),D=TWO_PI/11;for(let L=0;L<11;L++)drawPetal($,C,G,D*L,E,v,O,w)}}$.noStroke()}function drawPetal($,e,t,r,n,o,l,a){let i=cos(r)*l,_=sin(r)*a,d=e+i*o*l,s=t+_*o*a,u=t+_*n*a-o*R.random_num(.2,1),m=.7*n,f=PI/15,h=e+cos(r-f)*m*l,g=t+sin(r-f)*m*a,c=e+cos(r+f)*m*l,p=t+sin(r+f)*m*a;$.beginShape(),$.curveVertex(d,s),$.curveVertex(d,s),$.curveVertex(h,g),$.curveVertex(e+i*n*l,u),$.curveVertex(c,p),$.curveVertex(d,s),$.curveVertex(d,s),$.endShape()}function drawTree($,e,t,r){R.random_bool(.05)?drawPineTree($,e.x,e.y,e.z,e.s*R.random_num(3e3,5500),-HALF_PI,0,R.random_int(25,33),t,r):drawFurTree($,e,t,r)}function drawFurTree($,e,t,r){let n=e.x,o=e.y,l=e.z,a=e.s,i=map(e.zper,0,1,3450,6650)*R.random_num(.8,1.2);R.random_bool(.02)&&(i*=R.random_num(1.2,1.4));let _=.25*i;_*=a,i*=a;let d=getGroundColor(l),s=getGroundColor(l,.07);void 0!==t&&(d=t,s=r);let u=.1*_,m=.2*i,f=R.random_num(.7,.8),h=R.random_int(13,19),g=o,c=m*(1-pow(f,h))/(1-f);$.fill(d),$.beginShape(),$.vertex(n-.5*u,o),$.vertex(n-.05*u,o-c),$.vertex(n+.05*u,o-c),$.vertex(n+.5*u,o),$.endShape();for(let p=0;p<h;p++){let x=map(p,0,h,0,1),S=g-m;for(let P=0;P<8;P++){let y=map(P,0,7,0,1),T=map(cos(y*PI),-1,1,0,1),C=map(T,0,1,n-_,n+_),G=map(T,0,1,n+.2*_,n-.2*_),E=lerp(C,G,.5),v=lerp(C,E,.5),O=map(R.random_dec(),0,1,S-.4*m,S+.4*m),w=map(R.random_dec(),0,1,S-1*_,S-1.5*_),D=map(R.random_dec(),0,1,S+.1*_,S-.2*_),L=lerp(O,w,.25),k=lerp(O,w,.25);$.fill(lerpColor(d,s,x)),$.beginShape(),$.vertex(C,O),$.vertex(E,L),$.vertex(v,k),$.vertex(G,w),$.vertex(G,D),$.endShape()}m*=f,_*=.75,g=S}if(FORGETTING_TREES&&R.random_bool(.5)){$.strokeWeight(1),drawBrokenLine($,n,g,n,g-2*i,getColor(.2,0),getGroundColor(l,.07),30,10),$.noStroke();let A=R.random_int(0,60);for(let z=0;z<A;z++){let N=n+.5*R.random_num(-_,_),W=map(pow(R.random_dec(),3),0,1,g-.05*i,g-.5*i),I=map(pow(R.random_dec(),3),0,1,1,5);$.fill(getGroundColor(l,.07)),$.circle(N,W,I)}}$.noStroke()}function drawPineTree($,e,t,r,n,o,l,a,i,_){if(l>3)return;let d=l%2==1?a/4:a;l>=2&&(n*=3);let s=cos(o),u=sin(o),m=e+s*n,f=t+u*n,h=.02*n+.5;getColor(GROUND);let g=getGroundColor(r),c=getGroundColor(r,.07);void 0!==i&&(g=i,c=_),$.fill(g),$.triangle(e+u*h,t-s*h,m,f,e-u*h,t+s*h);for(let p=0;p<d;p++){let x=pow(map(p,0,d-1,0,1),.618),S=map(x,0,1,lerp(e,m,.2),m),P=map(x,0,1,lerp(t,f,.2),f),y=p%2==0?R.random_num(2,2.5):R.random_num(-2.5,-2);l>=1&&(y*=.2),R.random_bool(.9)&&drawPineTree($,S,P,r,n*R.random_num(.05,.3)*(1-x),o+y,l+1,d/2,i,_)}}function drawMegalith($,e){let t=e.x,r=e.y,n=e.z,o=e.s,l=e.zper,a=R.random_num(1e4,2e4)*o,i=5e4*o,_=getGroundColor(n,.01),d=t-a*map(l,0,1,.55,.65),s=t+a*map(l,0,1,.55,.65);$.strokeWeight(1);for(let u=0;u<49;u++){let m=map(u,0,49,0,1),f=map(u+1,0,49,0,1),h=map(m,0,1,r,r-i),g=map(f,0,1,r,r-i),c=lerpColor(_,getGroundColor(n+.05),pow(m,.25));$.fill(c),$.stroke(c),$.rect(d,h,d-.25*a,g),$.rect(s,h,s+.25*a,g)}$.noStroke()}function drawSpire($,e){let t=e.x,r=e.y,n=e.z,o=e.s,l=e.zper,a=40*o,i=a*R.random_num(80,110),_=r,d=r-i,s=getGroundColor(n),u=getGroundColor(n,.05);$.strokeWeight(2*l);let m=i/75;for(let f=0;f<75;f++){let h=map(f,0,74,0,1),g=t-a,c=t+a,p=map(h,0,1,_,d),x=lerpColor(s,u,h*h);$.fill(x),$.stroke(x),$.rect(g,p,c,p-m)}$.noStroke();{let S=450*o,P=R.random_num(0,TWO_PI),y=cos(P)*S,T=sin(P)*S*.2;spireTips.push({x:t,y:d,z:n,t:P});let C=t-y,G=t+y,E=d-T,v=d+T,O=87*o,w=R.random_int(1,2);for(let D=0;D<w;D++)map(D,0,w-1,0,1),$.fill(u),$.beginShape(),$.vertex(C,E),$.vertex(G,v),$.vertex(G,v+O),$.vertex(C,E+O),$.endShape(),E+=3*O,v+=3*O}$.noStroke()}function drawWires($){$.noFill(),$.stroke(getColor(.44)),$.strokeWeight(.5);let e=R.random_int(10,50),t=spireTips.length;for(let r=0;r<e;r++){map(r,0,e-1,0,1);let n=spireTips[R.random_int(0,t-1)],o=spireTips[R.random_int(0,t-1)];if(n!=o){let l=lerp(n.x,o.x,.15),a=lerp(n.x,o.x,.85);if(R.random_bool(.5)){let i=n.t,_=o.t,d=20*cos(i),s=4*sin(i),u=20*cos(_),m=4*sin(_),f=R.random_num(100,200);$.bezier(n.x+d,n.y+s,l+d,n.y+s+f,a+u,o.y+m+f,o.x+u,o.y+m),$.bezier(n.x-d,n.y-s,l-d,n.y-s+f,a-u,o.y-m+f,o.x-u,o.y-m)}}else{let h=n.x+150,g=horizon_y,c=lerp(n.x,h,.15),p=lerp(n.x,h,.85);$.bezier(n.x,n.y,c,n.y+150,p,g,h,g)}}}function drawBgArch($,e,t,r){let n=portals[0],o=n.x,l=n.y,a=n.d,i=.5*n.d*r,_=e,d=t;if(skyGlow&&(_=getSunColor(0),d=getSunColor(.4)),1==PORTAL_TYPE||6==PORTAL_TYPE){let s=o-1.5*a,u=o+1.5*a,m=l;$.fill(_),$.triangle(s,m,lerp(s,u,.5),m-2.598*a,u,m)}else drawGradientRect($,o-i,l+i,o+i,-100,_,d,0,.25,2)}function drawPalette($){$.noStroke(),$.fill(getSunColor(0)),$.rect(0,0,.5*myWidth,10),$.fill(getSunColor(1)),$.rect(.5*myWidth,0,myWidth,10),$.fill(getColor(0)),$.rect(0,10,.25*myWidth,20),$.fill(getColor(.33)),$.rect(.25*myWidth,10,.5*myWidth,20),$.fill(getColor(.67)),$.rect(.5*myWidth,10,.75*myWidth,20),$.fill(getColor(1)),$.rect(.75*myWidth,10,1*myWidth,20)}