0x7d33…da62

All memos sent from and to 0x7d33…da62.

**Sometimes, you must journey along an intricate and challenging path to uncover your authentic heritage.** *Roots* is raw, unrefined, rough, fresh. Fat pixels, naked textures, rude compositions. The *Roots* algorithm applies fundamental principles in design and visual language, inducing in the viewer a feeling of contemplating something classic and ancient, subtly related to the very origins of art. Maintaining simplicity, the diversity of *Roots* has been designed to encompass a wide range of compositional variations, surprising the viewer with unexpected richness. Full info and dev log here: https://www.fernandojerez.com/site/roots/
const hash=tokenData.@Id)%1e3,initPRNG=()=>Uint32Array ].map(((e,r &`U.substr(8*r+2,8),16) r,t=xS[3];return 1 19,Math.floor(e*( J),RATIO=9/16,DH=2!=WIDTH,HEIGHT,PD=1,ALFA=100,CFG={PALETTE,BGCOLOR,PIXEL=1,S=[["#212521","#540b0e@ ]],lastColorIndex=0;3,stains,filterLayer" eview,GRID,W,w t=-2;function s#`p(){createCanvas(DW"pixelDensity(1),c@draw!; if(background(("ROOTS".charAt(e%5)$o@(umLS:2,soften:!a[$ of i)+ t(n.x,n.y,Qr!4 r<DW;r+=20)A?@
**Sometimes, you must journey along an intricate and challenging path to uncover your authentic heritage.** *Roots* is raw, unrefined, rough, fresh. Fat pixels, naked textures, rude compositions. The *Roots* algorithm applies fundamental principles in design and visual language, inducing in the viewer a feeling of contemplating something classic and ancient, subtly related to the very origins of art. Maintaining simplicity, the diversity within *Roots* has been crafted to encompass a wide range of compositional variations, surprising the viewer with unexpected richness. Full info and dev log here: https://www.fernandojerez.com/site/roots/
const hash=tokenData.hash,ID=parseFloat(tokenData.tokenId)%1e3,initPRNG=()=>Uint32Array.from([0,0,0,0].map(((e,n)=>parseInt(hash.substr(8*n+2,8),16))));let xS=initPRNG();const prng=e=>{let n,r=xS[3];return xS[3]=xS[2],xS[2]=xS[1],xS[1]=n=xS[0],r^=r<<11,r^=r>>>8,xS[0]=r^n^n>>>19,Math.floor(e*(xS[0]/4294967296))},prand=(e,n)=>e+prng(n-e),fract=e=>e-Math.floor(e),PI=Math.PI,D2G=Math.PI/180,G2D=180/Math.PI,RATIO=9/16,DW=2400,DH=Math.round(1350);let WIDTH,HEIGHT,scene,graphics,graphics2,decals,ani,LW,PD=1,F=setF(),NX=0,stop=!1,initTime=0;function setup(){createCanvas(DW,DH),noiseSeed(1),PD=pixelDensity(1),colorMode(HSB,360,100,100,100),canvasResize(),scene=makeGraphics(DW,DH),sc2=makeGraphics(1584,.66*DH),graphics=makeGraphics(DW,DH),graphics2=makeGraphics(DW,DH),decals=makeGraphics(DW,DH),ani=makeGraphics(DW,DH),resetScene(),document.addEventListener("dblclick",(e=>{ndv()}))}function draw(){drawingContext.imageSmoothingEnabled=!0,background(F.HUE,20,100);for(let e=0;e<10;e++)LW.move(),LW.display(),addNoise();scene.background(F.HUE,20,F.BW||F.BBG?0:100),scene.image(graphics,0,0),F.burn?(scene.blendMode(BURN),scene.image(graphics2,0,0)):(scene.blendMode(MULTIPLY),scene.image(graphics,0,0)),scene.blendMode(SOFT_LIGHT),scene.image(decals,0,0),scene.blendMode(BLEND),imageMode(CENTER),rectMode(CENTER),push(),translate(width/2,height/2),image(scene,0,0,1.1*WIDTH,1.1*HEIGHT),F.BW&&(noStroke(),blendMode(OVERLAY),fill(0,0,100,80),rect(0,0,width,height)),pop(),stop||0!=LW.walkers.length||(stop=!0)}function ndv(){noiseSeed(floor(1e8*Math.random())),resetScene()}function keyPressed(){if(stop&&("s"==key||"S"==key)){let e=makeGraphics(DW,DH);e.imageMode(CENTER),e.push(),e.translate(1200,DH/2),e.image(scene,0,0,2640,1.1*DH),F.BW&&(e.noStroke(),e.blendMode(OVERLAY),e.fill(0,0,100,80),e.rect(0,0,e.width,e.height)),e.pop(),e.save("renaissance.png")}"r"!=key&&"R"!=key||ndv()}function windowResized(){canvasResize()}function setF(){for(let e=0;e<500;e++)prng(2);let e=1200+prand(-1,2)*DW*.66,n=DH/2+prand(-1,2)*DH*.66;prng(5)||(e=1200,n=DH/2);let r=1200==e&&n==DH/2,a=0,t=0;prng(3)||(prng(2)||(a=prand(-5,6)/10),prng(2)||(t=prand(-5,6)/5));let i=Math.PI/prand(2,6);return{density:prand(3,7),sides:[2,2,3,3,4,4,6,8,60][prng(9)],branchAngleA:i,branchAngleB:-i,vgiro:(prng(2),.1),rotation:prng(9)*Math.PI/4,offset:!prng(10),shadow:1.5,nz:1e-4*(r?10:prand(1,11)),zoom:[15,30,45][prng(3)],vgGradient:prng(10),cooldown:[0,10,50,150][prng(4)],RAG:prng(2)?5e4:50,BBG:prng(3),BW:!prng(20),HUE:prng(360),HUE2:(250+prng(100))%360,polygon:4,burn:!prng(3),stripe:[10,60,90][prng(3)],hasCenter:prng(5),centerX:e,centerY:n,centerAngle:prand(0,5)*Math.PI/8,centerSides:300,gravityX:a,gravityY:t}}function resetScene(){xS=initPRNG(),NX=0,F=setF(),initTime=millis(),stop=!1,ani.clear(),decals.clear(),graphics2.clear(),graphics.clear(),ani.background(F.HUE,14,100),LW=new NWList(graphics);for(let e=0;e<DW;e+=60){let n=prng(DH);LW.add(e,n,-1)}if(1200==F.centerX&&F.centerY==DH/2)for(let e=0;e<10;e++)LW.add(1200,DH/2,-1)}function canvasResize(){let e=window.innerWidth,n=window.innerHeight;e<n/RATIO?(HEIGHT=n,WIDTH=n/RATIO):(WIDTH=e,HEIGHT=e*RATIO),resizeCanvas(window.innerWidth,window.innerHeight)}function makeGraphics(e,n){let r=createGraphics(e,n);return r.drawingContext.imageSmoothingEnabled=!0,r.pixelDensity(1),r.colorMode(HSB,360,100,100,100),r.clear(),r.rectMode(CENTER),r}function drawLights(){decals.rectMode(CENTER),decals.noStroke(),decals.fill(F.HUE2,10,100,15);for(let e=0;e<50;e++){let e=prand(50,200),n=(prand(50,500),prng(DW)),r=prng(DH);decals.rect(n,r,e,DH)}}function addNoise(){let e=NX,n=0;for(decals.strokeWeight(1.5);n<DH;)prng(5)&&(bri=100*noise(.01*e,.01*n),decals.stroke(F.HUE,0,10,70),decals.point(e,n)),n+=12*noise(.01*e,.01*n);NX+=2}class NWList{constructor(s){this.g=s,this.walkers=[],this.w=DW,this.h=DH}add(s,t,e=-1){-1==e&&(e=prng(360)*Math.PI/180);let l=new NoiseWalker(this,this.g,s,t,e);this.walkers.push(l)}move(){for(let s=0;s<this.walkers.length;s++)this.walkers[s].move();for(let s=this.walkers.length-1;s>=0;s--)this.walkers[s].alive||this.walkers.splice(s,1)}display(){for(let s=0;s<this.walkers.length;s++)this.walkers[s].display()}}class NoiseWalker{constructor(s,i,t,h,e=-1){this.swarm=s,this.g=i,this.x=t,this.y=h,this.W=i.width,this.H=i.height,this.speed=1,this.angle=e,this.targetAngle=e,this.life=0,this.lifespan=F.density*prand(100,500),this.alive=!0,this.offset=F.offset?prng(1e5):0,this.nz=F.nz,this.vgiro=F.vgiro,this.sides=F.sides,this.rot=F.rotation,this.gx=F.gravityX,this.gy=F.gravityY,this.grow=.6,this.cooldown=F.cooldown}move(){switch(this.life++,this.x+=cos(this.angle)*this.speed,this.y+=sin(this.angle)*this.speed,this.x+=this.gx*this.speed,this.y+=this.gy*this.speed,(this.x>this.W||this.x<0)&&(this.x=(this.x+this.W)%this.W,this.y=prng(this.H)),(this.y>this.H||this.y<0)&&(this.x=prng(this.W),this.y=(this.y+this.H)%this.H),F.vgGradient){case 1:this.vgiro=max(0,map(abs(this.x-DW/2),0,.5*DW,.1,-.1));break;case 2:this.vgiro=max(0,map(abs(this.x-DW/2),0,.5*DW,-.1,.1));break;case 3:this.vgiro=max(0,map(this.x,0,DW,-.05,.1));break;case 4:this.vgiro=max(0,map(this.x,0,DW,.1,-.05));break;case 5:this.vgiro=max(0,map(this.y,0,DH,-.05,.1));break;case 6:this.vgiro=max(0,map(this.y,0,DH,.1,-.05));break;case 7:this.vgiro=max(.01,map(dist(this.x,this.y,DW/2,DH/2),0,.8*DH,.1,-.1));break;case 8:this.vgiro=max(.01,map(dist(this.x,this.y,DW/2,DH/2),0,.8*DH,-.1,.1));break;default:break}if(F.hasCenter){if(dist(this.x,this.y,F.centerX,F.centerY)>200){let s=G2D*(atan2(this.y-F.centerY,this.x-F.centerX)+F.centerAngle);s=floor(s/(360/F.centerSides))*(360/F.centerSides),this.rot=s*D2G}}if(!prng(200)&&this.lifespan-this.life>10&&this.swarm.walkers.length<200){let s=new NoiseWalker(this.swarm,this.g,this.x,this.y,this.angle+F.branchAngleA);s.lifespan=(this.lifespan-this.life)*this.grow,this.swarm.walkers.push(s),s=new NoiseWalker(this.swarm,this.g,this.x,this.y,this.angle+F.branchAngleB),s.lifespan=(this.lifespan-this.life)*this.grow,this.swarm.walkers.push(s);let i=floor(100*noise(.006*this.x,.006*this.y)+F.HUE)%360,t=450;this.g.blendMode(F.BW?HARD_LIGHT:ADD),this.g.noStroke(),F.BW?this.g.fill(i,0,0,2):this.g.fill(i,60,50,3),this.g.ellipse(this.x,this.y,t,t),this.g.blendMode(BLEND)}if(this.cooldown<=0){let s=this.sides;this.targetAngle=this.rot+floor(map(noise((this.life+this.offset)*this.nz),0,1,0,2*s))*TWO_PI/s,this.targetAngle>TWO_PI?this.targetAngle-=TWO_PI:this.targetAngle<0&&(this.targetAngle+=TWO_PI),this.angle>TWO_PI?this.angle-=TWO_PI:this.angle<0&&(this.angle+=TWO_PI),this.targetAngle-this.angle>PI?this.targetAngle-=TWO_PI:this.targetAngle-this.angle<-PI&&(this.targetAngle+=TWO_PI),abs(this.targetAngle-this.angle)<=this.vgiro?this.angle=this.targetAngle:this.angle+=Math.sign(this.targetAngle-this.angle)*this.vgiro}else this.cooldown--}display(){let s=min(350,map(max(this.life,0),0,this.lifespan,10+this.lifespan/F.zoom,1));if(this.life<this.lifespan){if(this.g.push(),this.g.translate(this.x,this.y),this.g.strokeWeight(4),this.g.stroke(F.HUE,F.BW?0:100,prand(15,30),F.BW?30:20),this.life%2==0&&this.g.line(0,0,0,10+s*F.shadow),s>F.RAG&&this.g.scale(map(floor(this.life)%s,0,s-1,.75,1)),this.life%1==0){this.g.fill(F.HUE2,0,F.BW?0:min(F.stripe,map(this.life,0,100,0,F.stripe))),this.g.noStroke();let i=1.1,t=.3;this.g.rect(0,0,s*i,s*t),this.g.rect(0,0,s*t,s*i)}this.g.stroke(F.HUE,90,0,F.BW?5:10),this.g.strokeWeight(4),this.g.fill(F.HUE,0,200),this.g.rect(0,0,s,s),this.g.noStroke(),this.g.fill(F.HUE,0,10),this.g.rect(0,0,s-4,s-4),this.g.pop(),graphics2.push(),graphics2.translate(this.x,this.y),graphics2.stroke(F.HUE2+40*noise(.01*this.life),F.BW?0:35,F.BW?60:100,100),graphics2.strokeWeight(2),graphics2.noFill(),graphics2.rect(0,0,s-4,s-4),graphics2.pop()}else this.alive=!1}}
***Renaissance*** invites you to think about the process of growing back or regenerating after a period of loss or damage. It suggests the idea of new growth and renewal that is fueled by the energy released during the period of change. We see this in the world today. Abandoned cities after a catastrophe where nature claims the territory invading buildings and cracking structures. Or in a more intimate way, the energy that drives us to recover and rebuild after a loss. Renaissance always propels life forward, overcoming destruction. Without destruction, there is no room for new life. **Motivation** It’s all about two main concepts: Energy and transformation. The idea that life prevails even after the worst catastrophes made me imagine a scenario where a new form of life could emerge over the ruins and chaos, fueled by an enigmatic source of energy. The science fiction lover in me began to imagine an alien world where strange pseudo-organic forms started to emerge from the remnants of an abandoned structure, pushed forward by some mysterious energy source. On the other hand the romantic guy in me thinks of it as a regeneration period after a loss fueled by energy and motivation. A chaotic period full of emotions and encountered feelings. **Aesthetics** Renaissance is a collection where experimentation with light and movement has guided the creative process. An exploration of a visual territory where light and composition serve the initial concept: Energy and transformation. A convoluted system of pseudo-organic forms emerging over a more rigid and artificial structure represents the transformation, or the duality of destruction and life. Saturated colors, flash lights, and high contrast are used to illustrate the concept of energy driving and feeding the whole system. A composition where the strength lies in the light and the movement, enhances the idea of a world that is alive and constantly changing and regenerating. Through the creation of a pseudo-abstract work, the viewer is invited to envision various scenarios where transformation takes place: Science-fiction universes, unconventional architectural forms, or even fantastical botanical landscapes. **Animation** The animation has been added to enhance the rendering process of the final piece. It adds context to the work by presenting the transformation process in two phases: the creation of a chaotic state that gradually becomes organized and culminates in a final explosion of light and color to celebrate the emergence of a new life. **Non deterministic variations** In this project, the possibility for the viewer to interact with the artwork and generate non-deterministic variations is added. While the initial output is always the same, double-clicking or pressing 'R' reconstructs the piece by randomly modifying certain aspects of how the process of emergence occurs. This offers an opportunity to explore the algorithm within the scope of the minted piece, engaging the audience in the process of discovery and experimentation. I'm pleased to share with the viewer the feeling of exploration and discovery that artists experience when creating our collections. **Final words** The title 'Renaissance' means regeneration or being born again, but it also connects us with a period in history where there was a renewed interest in art and a burst of creativity. In a way, we are experiencing a second renaissance, this time focused on digital art. This collection aims to awaken the curiosity and imagination of the viewer, making them wonder: What is happening here? and hopefully communicate a positive message: There’s a new life when you find the energy and motivation. By adding non-deterministic variations, the viewer is encouraged to interact and better appreciate the beauty of the created artwork, making them part of the creation process. I hope you enjoy Renaissance.
**:: UMK [Ultra Mechanika]. Beyond technology ::** Imagine a world where technology not only advances mechanically, but also adapts and changes in response to its environment. In this view, machines could evolve into a variety of forms, from biological and organic to architectural and industrial, each with its own unique capabilities and characteristics. The UMK algorithm could be thought of as a life form that has evolved from a seed. Its DNA defines the way in which it grows and develops. **:: Motivation ::** UMK expands my previous explorations of the interaction between humans and technology. Previously, In the "Defrag Trilogy" (link in the website), I narrate a tale spanning three chapters, exploring the emotions we encounter as we mature amidst a technologically world. The conclusion: technology emerges victorious every time. This time, I delve into the idea of a world where human intervention is not necessary, showcasing a hypothetical scenario where machines operate and evolve independently. What would self-evolving technology look like? **:: Aesthetics ::** As a devout admirer of Manga and graphic novels, the style of the artwork is centered around creating a hand-drawn, captivating one-page masterpiece. With UMK, I embark on a journey of maximalist illustration. A path that pushes the boundaries of my previous creations to achieve figurative pieces that are both visually stunning and unpredictably intriguing. This maximalist approach is designed to evoke a sense of wonder and exploration. The intricate use of textures and interlocking geometries invites the viewer to dive into the artwork and be entranced by the details and nuances. **:: Animation ::** Animation is crafted to captivate and hold the viewer's attention. Sit back and savor the mesmerizing construction mechanics and the gentle flow of the subtle elements in the background. **:: Final words ::** In UMK there is a touch of the clean and dreamlike drawing of Jean Giraud (Moebius), the intricate technological structures of Katsuhiro Otomo, or the biomechanical orgies of H.R. Giger. These are some examples of artists who have left a lasting impression on me and whose works continue to shape my aesthetic sensibility. Art lies within the code itself. When we view the outcome on the screen, we are witnessing the crystallization of the algorithm at a specific moment, under certain conditions. The code is immutable and the results are mere coincidence. Enjoy UMK. **:: Interaction ::** You can restart the animation or save it as a hi resolution PNG image. Tap the screen or mouse click to show the reset/save buttons. Also you can use keys: 'S' to save , 'R' to restart
**The sale of UMK is a 24 hour timed Open Edition. There is no project size limit on this project. The sale will close on May 2nd at 12pm CT, 24 hours after opening.** *** **&nbsp;** **:: UMK [Ultra Mechanika]. Beyond technology ::** Imagine a world where technology not only advances mechanically, but also adapts and changes in response to its environment. In this view, machines could evolve into a variety of forms, from biological and organic to architectural and industrial, each with its own unique capabilities and characteristics. The UMK algorithm could be thought of as a life form that has evolved from a seed. Its DNA defines the way in which it grows and develops. **:: Motivation ::** UMK expands my previous explorations of the interaction between humans and technology. Previously, In the "Defrag Trilogy" (link in the website), I narrate a tale spanning three chapters, exploring the emotions we encounter as we mature amidst a technologically world. The conclusion: technology emerges victorious every time. This time, I delve into the idea of a world where human intervention is not necessary, showcasing a hypothetical scenario where machines operate and evolve independently. What would self-evolving technology look like? **:: Aesthetics ::** As a devout admirer of Manga and graphic novels, the style of the artwork is centered around creating a hand-drawn, captivating one-page masterpiece. With UMK, I embark on a journey of maximalist illustration. A path that pushes the boundaries of my previous creations to achieve figurative pieces that are both visually stunning and unpredictably intriguing. This maximalist approach is designed to evoke a sense of wonder and exploration. The intricate use of textures and interlocking geometries invites the viewer to dive into the artwork and be entranced by the details and nuances. **:: Animation ::** Animation is crafted to captivate and hold the viewer's attention. Sit back and savor the mesmerizing construction mechanics and the gentle flow of the subtle elements in the background. **:: Final words ::** In UMK there is a touch of the clean and dreamlike drawing of Jean Giraud (Moebius), the intricate technological structures of Katsuhiro Otomo, or the biomechanical orgies of H.R. Giger. These are some examples of artists who have left a lasting impression on me and whose works continue to shape my aesthetic sensibility. Art lies within the code itself. When we view the outcome on the screen, we are witnessing the crystallization of the algorithm at a specific moment, under certain conditions. The code is immutable and the results are mere coincidence. Enjoy UMK. **:: Interaction ::** You can restart the animation or save it as a hi resolution PNG image. Tap the screen or mouse click to show the reset/save buttons. Also you can use keys: 'S' to save , 'R' to restart
**:: UMK [Ultra Mechanika]. Beyond technology ::** Imagine a world where technology not only advances mechanically, but also adapts and changes in response to its environment. In this view, machines could evolve into a variety of forms, from biological and organic to architectural and industrial, each with its own unique capabilities and characteristics. The UMK algorithm could be thought of as a life form that has evolved from a seed. Its DNA defines the way in which it grows and develops. **:: Motivation ::** UMK expands my previous explorations of the interaction between humans and technology. Previously, In the "Defrag Trilogy" (link in the website), I narrate a tale spanning three chapters, exploring the emotions we encounter as we mature amidst a technologically world. The conclusion: technology emerges victorious every time. This time, I delve into the idea of a world where human intervention is not necessary, showcasing a hypothetical scenario where machines operate and evolve independently. What would self-evolving technology look like? **:: Aesthetics ::** As a devout admirer of Manga and graphic novels, the style of the artwork is centered around creating a hand-drawn, captivating one-page masterpiece. With UMK, I embark on a journey of maximalist illustration. A path that pushes the boundaries of my previous creations to achieve figurative pieces that are both visually stunning and unpredictably intriguing. This maximalist approach is designed to evoke a sense of wonder and exploration. The intricate use of textures and interlocking geometries invites the viewer to dive into the artwork and be entranced by the details and nuances. **:: Animation ::** Animation is crafted to captivate and hold the viewer's attention. Sit back and savor the mesmerizing construction mechanics and the gentle flow of the subtle elements in the background. **:: Final words ::** In UMK there is a touch of the clean and dreamlike drawing of Jean Giraud (Moebius), the intricate technological structures of Katsuhiro Otomo, or the biomechanical orgies of H.R. Giger. These are some examples of artists who have left a lasting impression on me and whose works continue to shape my aesthetic sensibility. Art lies within the code itself. When we view the outcome on the screen, we are witnessing the crystallization of the algorithm at a specific moment, under certain conditions. The code is immutable and the results are mere coincidence. Enjoy UMK. **:: Interaction ::** You can restart the animation or save it as a hi resolution PNG image. Tap the screen or mouse click to show the reset/save buttons. Also you can use keys: 'S' to save , 'R' to restart
const hash=tokenData.hash,ID=parseFloat(tokenData.tokenId)%1e3,initPRNG=()=>Uint32Array.from([0,0,0,0].map((_,i)=>parseInt(hash.substr(8*i+2,8),16)));let xS=initPRNG();const prng=a=>{let s,t=xS[3];return xS[3]=xS[2],xS[2]=xS[1],xS[1]=s=xS[0],t^=t<<11,t^=t>>>8,xS[0]=t^s^s>>>19,Math.floor(a*(xS[0]/4294967296))},prand=(a,b)=>a+prng(b-a),fract=a=>a-Math.floor(a),PI=Math.PI,D2G=PI/180;let AGE=0;const RATIO=1.5,DW=1600,DH=2400,R=DW/3e3;let WIDTH,HEIGHT,PD=1,SPEED,DENSITY,CUTCORNER,REBOUND,SI,FLIPPED,VGS,VGIRO2,HUE,HUEVAR,SIDESLIST,BLACK,OVER,FULLGRID,BGGRID,FRAMEGRID,WHITE,SAT,graphics,graphics2,decals,bg,scene,sc2,overlay,LW,BGLW,SLIDERS;function randGlobals(){for(xS=initPRNG(),console.clear(),console.log('UMK #️⃣'+ID+' by Fernando Jerez 2023'),console.log("💊"+hash),stop=!1,initTime=millis(),SPEED=1,DENSITY=prand(7,9)/10,CUTCORNER=!prng(4),REBOUND=prng(4)?0:1,SI=!prng(3),FLIPPED=SI&&prng(2),VGS=[prand(0,10)/100,prand(0,10)/100,prand(0,10)/100,prand(0,10)/100],prng(4)&&(prng(2)?(VGS[0]=VGS[1],VGS[2]=VGS[3]):(VGS[0]=VGS[3],VGS[1]=VGS[2]));VGS[0]+VGS[1]+VGS[2]+VGS[3]<.03;)VGS[prng(4)]=prand(0,10)/100;VGIRO2=prand(5,10)/100;do{HUE=prng(360),HUE>80&&(HUE=prng(360))}while(4==Math.round(HUE/60));HUEVAR=30,SIDESLIST=[2,3,4,6,8,30,40,60],CUTCORNER&&!prng(25)&&(SIDESLIST=[1]),SIDESLIST=getSides(),BLACK=!prng(13),WHITE=!prng(23)||BLACK&&!prng(9),OVER=prand(20,340),FULLGRID=prng(2),BGGRID=prng(5),FRAMEGRID=prng(WHITE?3:5),SAT=10*prand(5,10),AGE=prand(0,11)/10}let stop=!1,initTime=0,GUI={draw:!1,save:!1,reset:!1,x:0,y:0};function setup(){createCanvas(DW,DH),drawingContext.imageSmoothingEnabled=!0,PD=pixelDensity(1),colorMode(HSB,360,100,100,100),canvasResize(),graphics=makeGraphics(DW,DH),graphics2=makeGraphics(DW,DH),bg=makeGraphics(DW,DH),decals=makeGraphics(DW,DH),scene=makeGraphics(DW,DH),sc2=makeGraphics(800,1200),overlay=makeGraphics(DW,DH),resetScene()}function draw(){drawingContext.imageSmoothingEnabled=!0,SPEED<130&&(SPEED*=1.02);let speed=SPEED/(1+LW.walkers.length);for(let i=0;!stop&&i<speed;i++)LW.move(),LW.display(),i<30&&BGLW.step();scene.blendMode(BLEND),scene.background(0),scene.image(bg,0,0),graphics2.clear(),SLIDERS.step(),scene.image(graphics2,0,0),scene.imageMode(CENTER),scene.push(),scene.translate(800,1200),FLIPPED||scene.image(graphics,SI?.5*-LW.w:0,0),SI&&(scene.push(),scene.scale(-1,1),scene.image(graphics,.5*-LW.w,0),scene.pop()),FLIPPED&&scene.image(graphics,SI?.5*-LW.w:0,0),scene.pop(),scene.imageMode(CORNER),scene.image(decals,0,0),scene.blendMode(OVERLAY),scene.image(overlay,0,0),scene.blendMode(BLEND),push(),translate(WIDTH/2,HEIGHT/2),width<640?(sc2.image(scene,0,0,sc2.width,sc2.height),image(sc2,0,0,WIDTH,HEIGHT)):image(scene,0,0,WIDTH,HEIGHT),pop(),stop||0!=LW.walkers.length||0!=BGLW.walkers.length||(stop=!0),GUI.draw&&(fill(HUE,50,80,50),strokeWeight(1),rect(GUI.x,GUI.y,50,70),buttonGUI(GUI.x+80,GUI.y,110,70,"SAVE",0,35,35,0),buttonGUI(GUI.x-80,GUI.y,110,70,"RESET",35,0,0,35))}function buttonGUI(x,y,w,h,t,a=0,b=0,c=0,d=0){rectMode(CENTER),textAlign(CENTER,CENTER),textSize(20),stroke(0);let mx=mouseX+w/2,my=mouseY+h/2,hover=mx>x&&mx<x+w&&my>y&&my<y+h;GUI[t]=hover,fill(0,0,hover?0:100,90),rect(x,y,w,h,a,b,c,d),fill(0,0,hover?100:0),text(t,x,y,w,h,a,b,c,d)}function mousePressed(){GUI.draw=!0,GUI.x=mouseX,GUI.y=mouseY}function mouseReleased(){GUI.draw=!1,GUI.SAVE&&scene.save("ultramechanika.png"),GUI.RESET&&resetScene()}function keyPressed(){!stop||"s"!=key&&"S"!=key||scene.save("ultramechanika.png"),"r"!=key&&"R"!=key||resetScene()}function windowResized(){canvasResize()}function resetScene(){graphics.clear(),graphics2.clear(),bg.clear(),decals.clear(),randGlobals(),imageMode(CENTER),noiseSeed(prng(2147483647)),noiseDetail(4),SLIDERS=new SliderList,LW=new NWList(graphics,1),paintNoise(bg),randomBlood(bg),LW.walkers.push(new NoiseWalker(LW.g,LW.frame.x+.2*LW.frame.w+prng(.6*LW.frame.w),LW.frame.y+.2*LW.frame.h+prng(.6*LW.frame.h),prand(-360,360)*PI/180,LW.frame,0,!0,LW.scale)),BGLW=new WalkerList(bg),overlay.clear(),overlay.noStroke(),WHITE?overlay.fill(0,0,100,40):overlay.fill((HUE+OVER)%360,100,100,12),overlay.rect(0,0,DW,DH),makeClouds(overlay)}
class NoiseWalker{constructor(g,x,y,angle,frame,lifespan=0,first=!1,wscale=1){this.frame=frame,this.g=g,this.x=x,this.y=y,this.speed=1.5,this.angle=angle,this.tAng=angle,this.life=0,this.lfs=lifespan||DENSITY*(prand(30,50)/1e3)*frame.w*frame.h/max(1,wscale),this.alive=!0,this.cd=70,this.offset=prng(5e4),this.nc=0,this.nz=1e-4*prand(3,30),this.vgiro=.03,this.wires=1,this.scale=wscale,this.bTh=18*this.scale,this.vTh=6*this.scale,this.cTh=.002,this.thickness=this.bTh,this.hue=30,this.sat=5,this.bHue=[30,40],this.bSat=0,this.sides=frame.sideslist[prng(frame.sideslist.length)],this.rot=PI/2,4==this.sides&&(this.rot+=prng(2)*PI/4),2==this.sides&&(this.rot+=prng(4)*PI/4),this.rib=!prng(4),this.ribMod=prand(2,5),this.block=!1,this.blood=frame.blood,this.isOut=!1,this.coolIn=0,this.cHue(),this.dC(this.x,this.y,this.thickness),first&&this.dEnd()}move(){if(this.x+=cos(this.angle)*this.speed,this.y+=sin(this.angle)*this.speed,this.life++,this.nc+=1,this.cd--,this.alive=this.alive&&this.life<this.lfs,this.cB(),this.alive&&this.cd<0){let sides=this.sides;this.coolIn<=0?this.tAng=this.rot+floor(map(noise((this.nc+this.offset)*this.nz),0,1,0,2*sides))*TWO_PI/sides:this.nc+=REBOUND,this.tAng>TWO_PI&&(this.tAng-=TWO_PI),this.tAng<0&&(this.tAng+=TWO_PI),this.angle>TWO_PI&&(this.angle-=TWO_PI),this.angle<0&&(this.angle+=TWO_PI),this.tAng-this.angle>PI&&(this.tAng-=TWO_PI),this.tAng-this.angle<-PI&&(this.tAng+=TWO_PI),abs(this.tAng-this.angle)<=this.vgiro?this.angle=this.tAng:this.angle+=Math.sign(this.tAng-this.angle)*this.vgiro}this.life>=this.lfs&&this.dEnd()}display(){let band=floor(this.life/3)%this.ribMod>=this.rib;if(this.thickness=(this.bTh+this.vTh*sin(this.life*this.cTh))*(band?1:.8),this.dW(this.x,this.y,this.thickness,this.angle,band),this.block=prng(1e4)<17&&this.cd<=0&&this.coolIn<=0&&this.angle==this.tAng,this.block){if(prng(5)){let w=R*prand(80,320),h=w*prand(6,14)/10;if(this.g.push(),this.g.translate(this.x+cos(this.angle)*w/2,this.y+sin(this.angle)*w/2),this.g.rotate(this.angle),prng(3)){this.g.noStroke(),this.g.fill(0,0,BLACK?100:10,6),this.g.rect(-w/2,-h/2,1.5*DH,h),this.rSh(-w/2,-h/2,w,h),this.recR(-w/2,-h/2,w,h);let ang=PI*prng(2);BGLW.walkers.push(new Walker((SI?.5*-LW.w:0)+this.x+cos(this.angle)*w*.5,this.y+sin(this.angle)*w*.5,this.angle+HALF_PI+ang,4,this.rot)),SI&&BGLW.walkers.push(new Walker(DW-(.5*-LW.w+this.x+cos(this.angle)*w*.5),this.y+sin(this.angle)*w*.5,-this.angle+HALF_PI+ang,4,this.rot))}else h=w*prand(3,7)/10,this.rSh(-w/2,-h/2,w,h),this.mR(-w/2,-h/2,w,h),this.rR(-w/2,-h/2,w,h,10);this.g.pop(),this.x+=cos(this.angle)*w,this.y+=sin(this.angle)*w}else{let d=R*prand(120,410),r=d/2,cx=this.x+cos(this.angle)*r,cy=this.y+sin(this.angle)*r;if(LW.walkers.length<10&&!prng(5)){let branches=2+prng(7),arc=TWO_PI,offs=PI,ang=arc/branches;if(this.alive=!1,prng(2)){for(let i=ang;i<arc;i+=ang){let xx=cx+(r+4)*cos(this.angle+i+offs),yy=cy+(r+4)*sin(this.angle+i+offs);var w=new NoiseWalker(this.g,xx,yy,this.angle+i+offs,this.frame,prng(100)+floor((this.lfs-this.life)/branches),!1,this.scale);LW.walkers.push(w)}this.cSh(cx,cy,r,90,0),this.cSh(cx,cy,r,20,0),this.dCR(cx,cy,d),fCircle(bg,cx,cy,1.2*d,6)}else{for(let i=.5;i<branches;i++){let xx=cx+1.2*(i-branches/2)*this.thickness*cos(this.angle+HALF_PI),yy=cy+1.2*(i-branches/2)*this.thickness*sin(this.angle+HALF_PI);var w;(w=new NoiseWalker(this.g,xx,yy,this.angle,this.frame,prng(100)+floor((this.lfs-this.life)/branches),!1,this.scale)).offset=this.offset,LW.walkers.push(w)}w=r;let h=1.6*this.thickness*branches;this.g.push(),this.g.translate(this.x+cos(this.angle)*w/2,this.y+sin(this.angle)*w/2),this.g.rotate(this.angle+PI),this.recR(-w/2,-h/2,w,h),this.g.pop()}}else this.g.push(),this.g.translate(cx,cy),this.g.rotate(this.angle),WHITE||(this.g.fill(this.randHue(),100,100,4),this.g.noStroke(),this.g.ellipse(0,0,400,400)),this.recR(-r,.3*-r,d,.3*d),this.g.pop(),this.cSh(cx,cy,.75*r),prng(2)?this.dCR(cx,cy,.75*d):(this.dC(cx,cy,.75*d),fan(this.g,cx,cy,.3*r,.3*r),this.dCR(cx,cy,.4*d)),this.x+=cos(this.angle)*d,this.y+=sin(this.angle)*d,fCircle(bg,cx,cy,d,4)}this.cHue(),this.rib=!prng(3),this.ribMod=prand(2,5),this.wires=[1,1,1,1,1,1,1,1,2,2,2,2,2,3,4,5][prng(16)]}}dEnd(){let w,h=100*R;this.g.push(),this.g.translate(this.x,this.y),this.g.rotate(this.angle),this.cSh(0,0,.5*h,50,0),this.dCR(0,0,h),this.g.pop(),fCircle(bg,this.x,this.y,2*h,prand(2,5))}out(){return this.x<this.frame.x||this.x>this.frame.x+this.frame.w||this.y<this.frame.y||this.y>this.frame.y+this.frame.h}gVG(){let x=floor(this.x-this.frame.x),y=floor(this.y-this.frame.y);return this.frame.vg[constrain(x,0,this.frame.w-1)][constrain(y,0,this.frame.h-1)]}cB(){this.g.strokeWeight(10);let out=this.out();this.vgiro=out?VGIRO2:this.gVG(),!this.block&&out?CUTCORNER?(this.dW(this.x,this.y,this.thickness,this.angle,!1),this.x<this.frame.x&&(this.x=this.frame.x+this.frame.w,this.y=this.frame.y+prng(this.frame.h)),this.x>this.frame.x+this.frame.w&&(this.x=this.frame.x,this.y=this.frame.y+prng(this.frame.h)),this.y<this.frame.y&&(this.y=this.frame.y+this.frame.h,this.x=this.frame.x+prng(this.frame.w)),this.y>this.frame.y+this.frame.h&&(this.y=this.frame.y,this.x=this.frame.x+prng(this.frame.w))):(this.tAng=this.x<this.frame.x?0:this.x>this.frame.x+this.frame.w?PI:this.y<this.frame.y?PI/2:1.5*PI,this.tAng+=prand(-5,5)/10,this.isOut=!0,this.coolIn=150*R*noise(.01*this.life)):(this.coolIn--,this.isOut=!1),CUTCORNER&&!this.block&&out&&this.dW(this.x-5*cos(this.angle),this.y-5*sin(this.angle),this.thickness,this.angle,!1)}cHue(){this.hue=prand(HUE,HUE+HUEVAR)%360}randHue(v=HUEVAR){return prand(HUE,HUE+v)%360}dW(x,y,t,a,band){let thick=t/this.wires+.98*this.wires,clamp=this.wires>1&&floor(this.life/10)%8==0;this.g.stroke(0,10);let w=round(this.wires*thick/2);this.g.strokeWeight(1.3);for(let i=0;i<=3.5*w;i+=2){this.g.stroke(0,0,0,map(i,0,3.5*w,100,5));let r=prand(-10,10)/10;this.g.point(x+r,y+i+r)}for(let i=-w;i<=w;i+=2){let bri=prand(-10,10)+(band&&!clamp?90:20)*abs(sin(map(i,-w,w,0,PI*(clamp?1:this.wires))));0==this.rib&&1==this.wires&&noise(.03*this.life)*thick<i+thick/3&&(bri*=prand(4,10)/10),this.g.strokeWeight(3.5),this.g.stroke(this.hue,this.sat,min(100,5+1.15*bri));let xx=x+cos(a+HALF_PI)*i,yy=y+sin(a+HALF_PI)*i;this.g.point(xx,yy),this.rust(this.g,xx,yy)}}rR(x,y,w,h,n=1){for(let i=0;i<n;i++){let yy=prng(h-40),ww=prand(40,w),hh=max(40,prand(40,h-yy-40));this.mR(x+w-ww,y+yy,ww,hh)}}recR(x,y,w,h){let s;if(min(w,h)>60*R){let r=20*R,opt;switch(prng(3)){case 0:this.recR(x,y,w,h/2),this.recR(x,y+h/2,w,h/2);break;case 1:this.recR(x,y,w/2,h),this.recR(x+w/2,y,w/2,h);break;case 2:this.mR(x,y,w,h),this.recR(x+r,y+r,w-2*r,h-2*r)}}else this.mR(x,y,w,h)}mR(x,y,w,h,b=-1){if(!WHITE){let up=1.5*max(w,h),stp=10;this.g.stroke(0),this.g.strokeWeight(1.5),this.g.fill(this.randHue(),70,100,1);for(let i=stp+floor(x)%stp;i<up;i+=stp)this.g.noStroke(),this.g.rect(x+i,y,w,h),this.g.stroke(0,0,0,map(i,0,up,40,0)),this.rL(x+i,y,w,h)}let xx=x,yy=y;this.cHue();let hue=this.hue,sat=this.bSat;prng(5)||(sat=WHITE?0:SAT),b=-1==b?4:b;let dia=sqrt(w*w+h*h);this.g.noStroke();let levels=100/6;for(let i=0;i<w;i+=2)for(let j=0;j<h;j+=2){let bri;bri=i<b||j<b||i>w-b||j>h-b?prand(5,20):prand(-10,10)+floor(max(0,map(i+j,0,dia,2.4,90/(100/6))))*(100/6),this.g.fill(hue,sat,bri),this.g.rect(xx+i,yy+j,2.5,2.5)}}rSh(x,y,w,h,sh=26,bri=0){for(let i=0;i<sh;i+=1)this.g.strokeWeight(1.5),this.g.stroke(0,0,bri,map(i,0,sh,70,0)),this.rL(x+i*cos(this.angle-HALF_PI),y-i*sin(this.angle-HALF_PI),w,h,1)}rL(x,y,w,h,r=1){for(let i=0;i<w;i+=3)this.rP(x+i,y,r),this.rP(x+i,y+h,r);for(let j=0;j<h;j+=3)this.rP(x,y+j,r),this.rP(x+w,y+j,r)}rP(x,y,r=1){let rx=prand(10*-r,10*r)/10,ry=prand(10*-r,10*r)/10;this.g.point(x+rx,y+ry)}dCR(x,y,s){s>80*R?(this.dC(x,y,s,40*R),this.dCR(x,y,s-40*R)):this.dC(x,y,s)}dC(x,y,s,ring=1e4){this.cHue(),this.g.strokeWeight(2);let up=prng(2),hue=this.hue,sat=this.bSat;prng(3)||(sat=WHITE?0:SAT);let levels=10,o=floor(-s)%8,m=prng(2)?1:-1;for(let i=-s/2;i<s/2;i+=2)for(let j=-s/2;j<s/2;j+=2){let d=s/2-dist(i,j,0,0);if(d>0&&d<ring){let bri=prand(-10,10)+floor(d<5*R?10:10*floor(map(j,-s/2,s/2,up?4:10,up?10:4)));floor(i+m*j+o)%8==0&&(bri=prng(bri)),this.g.stroke(hue,sat,bri,d<2?50:100),this.g.strokeWeight(3),this.g.point(x+i,y+j)}}this.g.strokeWeight(6*R),this.g.stroke(0,0,5),this.g.noFill(),this.g.ellipse(x,y,s,s)}cSh(x,y,r,s=40,bri=0){let sh=s;for(let i=0;i<sh;i+=3){let stp=.7/(r+i);this.g.strokeWeight(1.5),this.g.stroke(0,0,bri,50*pow(map(i,0,sh,1,0),2));for(let a=0;a<=TWO_PI;a+=stp){let xx=x+(r+i)*cos(a),yy=y+(r+i)*sin(a),rr=prand(-10,10)/5;this.g.point(xx+rr,yy+rr)}}}rust(g,xx,yy){let a=max(0,map(noise(.001*xx,.001*yy),0,1,0,70*AGE));g.strokeWeight(.5*prand(1,6)),g.stroke(30,WHITE?0:40,prand(10,70),a);let r=30*R,rx=prand(-r,r),ry=prand(-r,r);g.point(xx+rx,yy+ry)}}
class Walker{constructor(x,y,angle,sides,rot){this.ox=x,this.oy=y,this.x=x,this.y=y,this.angle=angle,this.sides=sides,this.rot=rot,this.v=1.5,this.life=0,this.alive=!0,this.mod=10*prand(2,10),this.offs=prng(1e7),this.style=1,this.nextSlider=prand(60,200)}step(g){this.life++,this.nextSlider--,this.x+=this.v*cos(this.angle),this.y+=this.v*sin(this.angle),this.alive=this.x>0&&this.x<DW&&this.y>0&&this.y<DH,g.strokeWeight(1.5),g.stroke(0,0,BLACK?80:WHITE?10:30),g.point(this.x,this.y),this.nextSlider<=0&&(this.nextSlider=prand(150,300),SLIDERS.sliders.push(new Slider(this.ox,this.oy,this.x,this.y,this.angle,14)))}}class WalkerList{constructor(g){this.walkers=[],this.g=g}step(){for(let w of this.walkers)w.step(this.g);for(let i=this.walkers.length-1;i>=0;i--)this.walkers[i].alive||this.walkers.splice(i,1)}}class Slider{constructor(ox,oy,x,y,angle,s){this.ox=ox,this.oy=oy,this.x=x,this.y=y,this.angle=angle,this.v=prand(5,15)/15,this.s=s,this.w=s*prand(1,4),this.hue=(HUE+prng(30))%360}step(){stop&&(this.x+=this.v*cos(this.angle),this.y+=this.v*sin(this.angle),(this.x<0||this.x>DW||this.y<0||this.y>DH)&&(this.x=this.ox,this.y=this.oy,this.w=this.s*prand(1,4),this.v=prand(5,15)/15)),graphics2.push(),graphics2.translate(this.x,this.y),graphics2.rotate(this.angle),graphics2.stroke(HUE,BLACK?10:0,BLACK?80:WHITE?10:50),graphics2.strokeWeight(2.5),graphics2.fill(this.hue,WHITE?0:25,BLACK?5:95),graphics2.rect(.5*-this.w,.5*-this.s,this.w,this.s),graphics2.pop()}}class SliderList{constructor(){this.sliders=[]}step(){for(let s of this.sliders){for(let s2 of this.sliders)if(s!=s2&&s.ox==s2.ox&&s.oy==s2.oy){let d=(s.w+s2.w)/2;if(dist(s.x,s.y,s2.x,s2.y)<d){let v=s.v;s.v=s2.v,s2.v=v;let ang=atan2(s2.y-s.y,s2.x-s.x);s2.x=s.x+d*cos(ang),s2.y=s.y+d*sin(ang)}}s.step()}}} class NWList{constructor(g,wscale=1){this.g=g,this.scale=wscale,this.walkers=[];let bx=DW*(SI?.3:.1),by=.1*DW,bxf=.1*DW;this.w=DW-2*bx,this.h=DH-2*by,this.hue=prng(300),this.squares=0,decals.noFill(),decals.rectMode(CENTER),decals.stroke(0,0,100),decals.strokeWeight(2*bxf),decals.rect(DW/2,DH/2,DW,DH),this.makeFrame(bx,by,DW-2*bx,DH-2*by)}makeFrame(x,y,w,h){let bx=80*R,by=bx;bx=by=0;let frame={x:x+bx,y:y+0,w:w-2*bx,h:h-0,sideslist:SIDESLIST,blood:!1},cx1,cx2,cy;this.frame=frame,frame.vg=new Array(frame.w);for(let i=0;i<frame.w;i++){frame.vg[i]=new Array(frame.h);for(let j=0;j<frame.h;j++)cx1=map(i,0,frame.w-1,VGS[0],VGS[1]),cx2=map(i,0,frame.w-1,VGS[3],VGS[2]),cy=sq(map(j,0,frame.h-1,0,1)),frame.vg[i][j]=cx2*cy+cx1*(1-cy)}}move(){for(let i=0;i<this.walkers.length;i++)this.walkers[i].move();for(let i=this.walkers.length-1;i>=0;i--)this.walkers[i].alive||this.walkers.splice(i,1)}display(){for(let i=0;i<this.walkers.length;i++)this.walkers[i].display()}}
function canvasResize(){let W=window.innerWidth,H=window.innerHeight;W>H/1.5?(HEIGHT=H,WIDTH=H/1.5):(WIDTH=W,HEIGHT=1.5*W),resizeCanvas(WIDTH,HEIGHT)}function makeGraphics(w,h){let g=createGraphics(w,h);return g.drawingContext.imageSmoothingEnabled=!0,g.pixelDensity(1),g.colorMode(HSB,360,100,100,100),g.clear(),g}function getSides(){let s=[];for(let i=0;i<SIDESLIST.length;i++)prng(4)||s.push(SIDESLIST[i]);return 0==s.length&&s.push(SIDESLIST[prng(SIDESLIST.length)]),s}function fan(g,x,y,r,b,sides=0){let s=0==sides?prand(1,9):sides,ang=TWO_PI/s;for(let i=0;i<=TWO_PI;i+=ang)drawArc(g,x,y,r,b,i,i+.7*ang)}function drawArc(g,cx,cy,r,w,a1,a2){let ini=min(a1,a2),end=max(a1,a2),i;for(fillArc(g,cx,cy,r,r+w,a1,a2),g.stroke(0,0,6),g.strokeWeight(3.2),g.noFill(),g.beginShape(),i=ini;i<end;i+=.03)g.vertex(cx+r*cos(i),cy+r*sin(i));for(g.vertex(cx+r*cos(end),cy+r*sin(end)),i=end;i>ini;i-=.03)g.vertex(cx+(r+w)*cos(i),cy+(r+w)*sin(i));g.vertex(cx+(r+w)*cos(ini),cy+(r+w)*sin(ini)),g.endShape(CLOSE)}function fillArc(g,cx,cy,r1,r2,a1,a2){let ini=min(a1,a2),end=max(a1,a2);g.strokeWeight(4);for(let r=r1;r<=r2;r+=2)for(i=ini;i<end;i+=2/r)g.stroke(0,0,map(r,r1,r2,0,80)+prand(-20,20)),g.point(cx+r*cos(i),cy+r*sin(i))}function makeFrame(g){g.noStroke();let s=6,nz=.01,w=R*map(AGE,0,1,100,500);g.rectMode(CENTER);for(let i=0;i<DH;i+=6)g.fill(0,0,100,prand(40,60)),g.rect(0,i,w*noise(i*nz),6),g.rect(DW,i,w*noise(300+i*nz),6),g.rect(i,0,6,w*noise(600+i*nz)),g.rect(i,DH,6,w*noise(900+i*nz))}function paintNoise(g){let grid=80*R,offx=DW*(ID%20),offy=DH*floor(ID/20),r=4,nz=2/DW,cx=800,cy=800,d,a,x,y;g.noStroke(),g.background(HUE,WHITE?0:3,BLACK?5:100),g.strokeWeight(1),g.strokeCap(SQUARE);let bx=160,by=bx;for(let i=0;i<DW;i+=r)for(let j=0;j<DH;j+=r){d=dist(i,j,cx,cy),a=atan2(cx-i,cy-j),x=floor(i/grid)*grid,y=floor(j/grid)*grid;let n=1+floor(4*noise(1e4+(offx+x)*nz,5e3+(offy+y)*nz));g.stroke(0,0,BLACK?40:20*n,WHITE?50:25),!FULLGRID&&prng(n)||bgGrid(g,i,j,r,BGGRID)}decals.stroke(0,0,WHITE?10:80,WHITE?30:25),decals.strokeCap(SQUARE),r=WHITE?10:6;for(let i=0;i<DW;i+=r)for(let j=0;j<DH;j+=r)(i<bx||j<by||i>1440||j>2240)&&(decals.strokeWeight(WHITE?1.5:(r-1)*noise(1e4+(offx+i)*nz*3,5e3+(offy+j)*nz*3)),bgGrid(decals,i,j,r,FRAMEGRID));rectInvaders(bx,by,1280,2080,10)}function rectInvaders(x,y,w,h,thick){if(decals.stroke(0,0,12),decals.strokeWeight(WHITE?12:28),decals.rect(x+w/2,y+h/2,w,h),!BLACK&&!WHITE){decals.strokeWeight(1),decals.stroke(0,0,prand(80,90));for(let xx=x;xx<=x+w;xx+=thick)for(let yy=y;yy<=y+h;yy+=thick)if(xx==x||yy==y||xx==x+w||yy==y+h)for(let i=1;i<thick/2;i++)for(let j=0;j<thick-1;j++)prng(100)<10+60*noise(.01*xx,.01*yy)&&(decals.point(xx+i-1,yy+j-thick/2),decals.point(xx-i,yy+j-thick/2))}}function bgGrid(g,i,j,r,style){switch(style){case 0:prng(8)?g.line(i,j,i+r,j+r):g.line(i+r,j,i,j+r);break;case 1:prng(8)?g.line(i+r,j,i,j+r):g.line(i,j,i+r,j+r);break;case 2:prng(6)&&g.line(i,j,i+r,j);break;case 3:prng(8)?g.line(i,j,i+r,j+r):g.point(i+.5*r,j+.5*r);break;case 4:prng(8)?g.line(i,j,i+r,j):g.point(i+.5*r,j)}}function makeClouds(g){noiseDetail(3);let s=3.2,nx=15/DW,ny=.2*nx,th=map(AGE,0,1,.7,.6);g.strokeWeight(1.5*s),g.stroke(HUE+OVER%360,WHITE?0:5,WHITE||BLACK?100:10,map(AGE,0,1,15,40));for(let x=0;x<DW;x+=s)for(let y=0;y<DH;y+=s){let n=noise((DW+x)*nx,y*ny),r=0;n>=th-.03&&(r=6.4);let rx=prand(-r,r),ry=prand(-r,r);n>=th&&g.point((x+y)%DW+rx,y+ry)}}function randomBlood(g){let n=900,nx=4/DW,ny=2/DH,r=4800;g.noStroke(),noiseDetail(4);for(let i=0;i<n;i++){let x=prng(DW),y=prng(DH);if(!prng(1)&&(x=prng(DW),y=prng(DH),noise(x*nx,y*ny)>.6)){let w=R*prand(2,14)*2.5;g.push(),g.translate(x,y),dip(g,w,w),dip(g,w,w),dip(g,.7*w,.7*w),g.pop()}}}function dip(g,w,h){g.stroke(0,0,BLACK?100:0,25),g.noFill(),g.strokeWeight(1),g.beginShape();let offs=prng(1e3);for(let a=0;a<TWO_PI;a+=TWO_PI/4){let r1=w/2+(noise(1*(a+offs))-.5)*w/2,r2=h/2+(noise(1*(a+offs))-.5)*h/2;g.vertex(r1*cos(a),r2*sin(a))}g.endShape(CLOSE)}function fCircle(g,x,y,d,rep){for(let i=0;i<rep;i++){g.noFill(),g.stroke(0,0,70),g.strokeWeight(BLACK?2.5:1.5);let r=d+d*i*.2;g.circle((SI?.5*-LW.w:0)+x,y,r),SI&&g.circle(DW-(.5*-LW.w+x),y,r)}}
const hash=tokenData.hash,ID=parseFloat(tokenData.tokenId)%1e3,initPRNG=()=>Uint32Array.from([0,0,0,0].map((_,i)=>parseInt(hash.substr(8*i+2,8),16)));let xS=initPRNG();const prng=a=>{let s,t=xS[3];return xS[3]=xS[2],xS[2]=xS[1],xS[1]=s=xS[0],t^=t<<11,t^=t>>>8,xS[0]=t^s^s>>>19,Math.floor(a*(xS[0]/4294967296))},prand=(a,b)=>a+prng(b-a),fract=a=>a-Math.floor(a),PI=Math.PI,D2G=PI/180;let AGE=0;const RATIO=1.5,DW=1600,DH=2400,R=DW/3e3;let WIDTH,HEIGHT,PD=1,SPEED,DENSITY,CUTCORNER,REBOUND,SI,FLIPPED,VGS,VGIRO2,HUE,HUEVAR,SIDESLIST,BLACK,OVER,FULLGRID,BGGRID,FRAMEGRID,WHITE,SAT,graphics,graphics2,decals,bg,scene,sc2,overlay,LW,BGLW,SLIDERS;function randGlobals(){for(xS=initPRNG(),console.clear(),console.log('UMK #️⃣'+ID+' by Fernando Jerez 2023'),console.log("💊"+hash),stop=!1,initTime=millis(),SPEED=1,DENSITY=prand(7,9)/10,CUTCORNER=!prng(4),REBOUND=prng(4)?0:1,SI=!prng(3),FLIPPED=SI&&prng(2),VGS=[prand(0,10)/100,prand(0,10)/100,prand(0,10)/100,prand(0,10)/100],prng(4)&&(prng(2)?(VGS[0]=VGS[1],VGS[2]=VGS[3]):(VGS[0]=VGS[3],VGS[1]=VGS[2]));VGS[0]+VGS[1]+VGS[2]+VGS[3]<.03;)VGS[prng(4)]=prand(0,10)/100;VGIRO2=prand(5,10)/100;do{HUE=prng(360),HUE>80&&(HUE=prng(360))}while(4==Math.round(HUE/60));HUEVAR=30,SIDESLIST=[2,3,4,6,8,30,40,60],CUTCORNER&&!prng(25)&&(SIDESLIST=[1]),SIDESLIST=getSides(),BLACK=!prng(13),WHITE=!prng(23)||BLACK&&!prng(9),OVER=prand(20,340),FULLGRID=prng(2),BGGRID=prng(5),FRAMEGRID=prng(WHITE?3:5),SAT=10*prand(5,10),AGE=prand(0,11)/10}let stop=!1,initTime=0,GUI={draw:!1,save:!1,reset:!1,x:0,y:0};function setup(){createCanvas(DW,DH),drawingContext.imageSmoothingEnabled=!0,PD=pixelDensity(1),colorMode(HSB,360,100,100,100),canvasResize(),graphics=makeGraphics(DW,DH),graphics2=makeGraphics(DW,DH),bg=makeGraphics(DW,DH),decals=makeGraphics(DW,DH),scene=makeGraphics(DW,DH),sc2=makeGraphics(800,1200),overlay=makeGraphics(DW,DH),resetScene()}function draw(){drawingContext.imageSmoothingEnabled=!0,SPEED<130&&(SPEED*=1.02);let speed=SPEED/(1+LW.walkers.length);for(let i=0;!stop&&i<speed;i++)LW.move(),LW.display(),i<30&&BGLW.step();scene.blendMode(BLEND),scene.background(0),scene.image(bg,0,0),graphics2.clear(),SLIDERS.step(),scene.image(graphics2,0,0),scene.imageMode(CENTER),scene.push(),scene.translate(800,1200),FLIPPED||scene.image(graphics,SI?.5*-LW.w:0,0),SI&&(scene.push(),scene.scale(-1,1),scene.image(graphics,.5*-LW.w,0),scene.pop()),FLIPPED&&scene.image(graphics,SI?.5*-LW.w:0,0),scene.pop(),scene.imageMode(CORNER),scene.image(decals,0,0),scene.blendMode(OVERLAY),scene.image(overlay,0,0),scene.blendMode(BLEND),push(),translate(WIDTH/2,HEIGHT/2),width<640?(sc2.image(scene,0,0,sc2.width,sc2.height),image(sc2,0,0,WIDTH,HEIGHT)):image(scene,0,0,WIDTH,HEIGHT),pop(),stop||0!=LW.walkers.length||0!=BGLW.walkers.length||(stop=!0),GUI.draw&&(fill(HUE,50,80,50),strokeWeight(1),rect(GUI.x,GUI.y,50,70),buttonGUI(GUI.x+80,GUI.y,110,70,"SAVE",0,35,35,0),buttonGUI(GUI.x-80,GUI.y,110,70,"RESET",35,0,0,35))}function buttonGUI(x,y,w,h,t,a=0,b=0,c=0,d=0){rectMode(CENTER),textAlign(CENTER,CENTER),textSize(20),stroke(0);let mx=mouseX+w/2,my=mouseY+h/2,hover=mx>x&&mx<x+w&&my>y&&my<y+h;GUI[t]=hover,fill(0,0,hover?0:100,90),rect(x,y,w,h,a,b,c,d),fill(0,0,hover?100:0),text(t,x,y,w,h,a,b,c,d)}function mousePressed(){GUI.draw=!0,GUI.x=mouseX,GUI.y=mouseY}function mouseReleased(){GUI.draw=!1,GUI.SAVE&&scene.save("ultramekanica.png"),GUI.RESET&&resetScene()}function keyPressed(){!stop||"s"!=key&&"S"!=key||scene.save("ultramechanika.png"),"r"!=key&&"R"!=key||resetScene()}function windowResized(){canvasResize()}function resetScene(){graphics.clear(),graphics2.clear(),bg.clear(),decals.clear(),randGlobals(),imageMode(CENTER),noiseSeed(prng(2147483647)),noiseDetail(4),SLIDERS=new SliderList,LW=new NWList(graphics,1),paintNoise(bg),randomBlood(bg),LW.walkers.push(new NoiseWalker(LW.g,LW.frame.x+.2*LW.frame.w+prng(.6*LW.frame.w),LW.frame.y+.2*LW.frame.h+prng(.6*LW.frame.h),prand(-360,360)*PI/180,LW.frame,0,!0,LW.scale)),BGLW=new WalkerList(bg),overlay.clear(),overlay.noStroke(),WHITE?overlay.fill(0,0,100,40):overlay.fill((HUE+OVER)%360,100,100,12),overlay.rect(0,0,DW,DH),makeClouds(overlay)}
function wallR(e,r,t){let o=M.walls.clone();rainbowWalls&&o.color.set(ethpal[prng(ethpal.length)]);for(let n=0;n<=t;n++){for(let t=0;t<e.x;t++)(n%3==2||n%3==0&&0==prng(6))&&(G.add(B([1,n%3==2?1:2,1],[t+r.x,n+r.y+1,r.z],o)),t<3&&G.add(B([1,n%3==2?1:2,1],[t+r.x,n+r.y+1,r.z+e.z-1],o)));for(let t=0;t<e.z;t++)(n%3==2||n%3==0&&0==prng(6))&&(G.add(B([1,n%3==2?1:2,1],[r.x,n+r.y+1,t+r.z],o)),t<3&&G.add(B([1,n%3==2?1:2,1],[r.x+e.x-1,n+r.y+1,t+r.z],o)))}G.add(B([e.x,1,e.z],[r.x,2+r.y+t,r.z],o))}function s3D(e,r,t,o,n,a){let d=new THREE.Mesh(new THREE.SphereGeometry(r*grid,t,o),a);return d.position.set(e.x*grid,e.y*grid,e.z*grid),d.scale.set(1,n,1),d}function B(e,r,t,o=0){let n=e[o?2:0],a=e[1],d=e[o?0:2],i=r[o?2:0],l=r[1],s=r[o?0:2],p=new THREE.BoxGeometry(n*grid+.1,a*grid+.1,d*grid+.1),x=new THREE.Mesh(p,t);x.position.set((i+n/2)*grid,(l+a/2)*grid,(s+d/2)*grid),n/=5;var g=[d/=4,0,d,a/=4,0,a,0,0,...o?[d,n,0,n,0,0,d,0]:[0,d,0,0,n,0,n,d],n,0,n,a,0,a,0,0];p.faceVertexUvs[0]=[];for(let e=0;e<3;e++){let r=8*e;for(let e=0;e<2;e++)p.faceVertexUvs[0].push([V2(g[r],g[r+1]),V2(g[r+2],g[r+3]),V2(g[r+6],g[r+7])]),p.faceVertexUvs[0].push([V2(g[r+2],g[r+3]),V2(g[r+4],g[r+5]),V2(g[r+6],g[r+7])])}return p.uvsNeedUpdate=!0,x}var mH=0,mouseD=!1;document.addEventListener("mousedown",e=>{mouseD=!0}),document.addEventListener("mouseup",e=>{mouseD=!1,rotX=RX,rotY=RY}),document.addEventListener("mousemove",e=>{mH=0,mouseD&&(rotX=Math.max(Math.min(rotX+.004*e.movementY,RX+.4),RX-.4),rotY=Math.max(Math.min(rotY+.004*e.movementX,RY+.4),RY-.4))}),document.addEventListener("keypress",e=>{"1"==e.key?(rotX=0,rotY=PI):"2"==e.key?(rotX=0,rotY=.75*PI):"3"==e.key?(rotX=0,rotY=PI/2):(rotX=RX,rotY=RY),"0"==e.key&&(R.setClearColor(0,0),bgplane.visible=!bgplane.visible)}),window.addEventListener("resize",function(){let e=window.innerWidth,r=window.innerHeight;C.left=-e/2,C.right=e/2,C.top=r/2,C.bottom=-r/2,C.zoom=Math.min(e,r)/scale,C.updateProjectionMatrix(),R.setSize(e,r),post.resize()});var vaspa=10;function animate(){let e=clock.getDelta();mH+=e,R.domElement.style.cursor=mH>3?"none":"default";for(let e of lights)e.emissiveIntensity=prng(16)?2:0;if(e<.3){moveCar(e),m.uniforms.dt.value+=.5*e;for(let r of ele)r.delay<=0?(r.stop-=e,r.stop<=0&&(r.stop=4+prng(4),r.dir=prng(2)?5:-5,r.delay=2+prng(3)),r.model.position.y+=e*r.dir,(r.model.position.y>r.maxy||r.model.position.y<r.miny)&&(r.model.position.y=r.model.position.y>r.maxy?r.maxy:r.miny,r.dir*=-1)):r.delay-=e;for(let r of trains)r.d-=e,r.broken-=e,r.broken<=0&&(r.broken=r.w?1+prng(3):prand(20,120),r.w=!r.w),r.w&&r.d<=0?(r.w&&(r.m.emissiveIntensity=2),r.z?r.t.position.z+=r.v*e:r.t.position.x+=r.v*e,!r.z&&(r.t.position.x>(gx-r.l)*grid||r.t.position.x<10)&&(r.v=-r.v,r.t.position.x+=r.v*e,r.d=prng(3)),r.z&&(r.t.position.z>(gz-r.l)*grid||r.t.position.z<10)&&(r.v=-r.v,r.t.position.z+=r.v*e,r.d=prng(3))):r.w||(r.m.emissiveIntensity=prng(10)/10);if(H)if(H.p-=e,H.a.rotation.y+=vaspa*e,H.ac.rotation.x-=1.3*vaspa*e,H.p<=0){if((vaspa=Math.min(10,vaspa+e))>=10){let r=Math.min(1,.1+(H.h.position.y-H.py)/40);H.h.rotation.y+=.2*r*e,H.h.position.y+=r*H.v*e,H.h.position.y>400&&(H.v*=-1),H.h.position.y<=H.py&&(H.h.position.y=H.py,H.v*=-1,H.p=10)}}else vaspa=Math.max(0,vaspa-4*e);eth&&(eth.rotation.y+=e),tex1.offset.y-=e,city.rotation.x+=(rotX-city.rotation.x)/5,city.rotation.y+=(rotY-city.rotation.y)/5}post.render(SC,C),requestAnimationFrame(animate)}function generateTexture(){let e=32,r=document.createElement("canvas");r.width=r.height=e;let t=r.getContext("2d");t.fillStyle="#ffffff",t.fillRect(0,0,e,e),t.fillStyle="#aaaaaa99";for(let r=0;r<=e;r+=4)t.fillRect(r,prng(e/3+ABS(16-r)),2,8),t.fillRect(r,prng(e+ABS(16-r)),1,8);return r}animate();
function rLev(e,r){G.add(B([gx+border,e,gz+border],[r.x,r.y,r.z],M.dirt));for(let t=0;t<2;t++){let t=2;for(;t<gx;){let o=prand(1,5);for(let n=0;n<2;n++){let a=r.y+1+prng(e-o),d=r.z-(.2+prng(5)/7);G.add(B([o,o,3],[r.x+t,a,d],M.ground,n)),o>1&&prng(1-FL(r.y/10))>1&&palette&&G.add(B([o/2,o/2,3],[r.x+t+o/4,a+o/4,d-.6],prng(2)&&rainbowRocks?mRW(prng(ethpal.length)):M.walls,n))}t+=o+1+prng(6)}}sewers(e,r)}function uLev(e,r){let t=border;G.add(B([gx,gh,gz],[r.x+4,r.y,r.z+4],M.core)),G.add(B([gx+t/2,1,gz+t/2],[r.x+2.5,r.y+1.5,r.z+2.5],M.sidewalk)),G.add(B([gx+t,2,gz+t],[r.x,r.y,r.z],M.dirt)),G.add(B([gx+t,2,gz+t],[r.x,r.y+e-2,r.z],M.dirt)),G.add(B([6+prng(gx/4),e-2,6+prng(gx/4)],[r.x,r.y+1,r.z],M.dirt));let o=5+prng(gx/4);G.add(B([o,e-2,1],[r.x+t+gx-o,r.y+1,r.z],M.dirt)),G.add(B([1,e-2,o],[r.x,r.y+1,r.z+t+gx-o],M.dirt));let n=15+prng(gx/3);train({x:n,y:r.y,z:r.z},0),train({x:r.x,y:r.y,z:n},1),sewers(e,r)}function sewers(e,r){for(let t=0;t<2;t++){let o=r.x+1+prng(gx),n=r.y+3,a=2+prng(4),d=4,i=prng(4);for(let l=0;l<i&&o<gx-a-5;l++)G.add(B([a,e-2,1],[o+2,r.y+1,r.z+1],M.dirt,t)),G.add(B([a+6,e-2,1],[o-1,r.y+1,r.z],M.dirt,t)),G.add(B([a,1,d],[o+2,n+3,r.z-d],M.walls,t)),G.add(B([a+2,1,d],[o+1,n,r.z-d],M.walls,t)),G.add(B([1,3,d],[o+1,n,r.z-d],M.walls,t)),G.add(B([1,3,d],[o+a+2,n,r.z-d],M.walls,t)),G.add(B([a,1,3],[o+2,n+1,r.z-d],M.water,t)),G.add(B([a,302,1],[o+2,n-300,r.z-d-1],M.water,t)),o+=a+4,a=2+prng(4)}}function heli(e){let r=new THREE.Group,t=new THREE.Group,o=new THREE.Group;r.add(B([2,3.5,4],[-1,.5,-2],M.vehicle)),r.add(B([2.2,2,2.5],[-1.1,1.3,-2.1],M.neon)),r.add(B([.5,.8,6],[-.5,2,2],M.vehicle)),t.add(B([12,.3,1],[-6,4,-.5],M.neon).rotateY(PI/6)),t.add(B([1,.3,12],[-.5,4,-6],M.neon).rotateY(PI/6)),r.add(t),o.add(B([3,.3,.7],[-1.5,-.15,-.35],M.neon).rotateZ(PI/2).rotateY(PI/4)),o.add(B([.7,.3,3],[-.35,-.15,-1.5],M.neon).rotateZ(PI/2).rotateY(PI/4)),o.position.set(0,2.5*grid,7*grid),r.add(o),r.add(B([1,.5,5],[-2,0,-2.5],M.vehicle)),r.add(B([1,.5,5],[1,0,-2.5],M.vehicle)),r.position.set(e.x*grid,400,e.z*grid),r.rotateY(prng(4)*PI/2),G.add(r),H={h:r,a:t,ac:o,py:e.y*grid,y:400,v:-16,vg:0,p:0}}function tree(e,r,t){let o=M.tree2.clone();if(randTrees&&o.color.set(COL(prand(40,165),100,prand(40,70))),sakuraTrees){let e=COL(319,80,prand(75,96));o=new THREE.MeshLambertMaterial({color:e,emissive:e,emissiveIntensity:.4})}let n=prng(100)?o:M.tree3,a=sakuraTrees?3:2+prng(4),d=rtrees?prng(3):0;G.add(B([.8,6,.8],[e,r,t],M.tree1)),G.add(B([1,a,1],[e,r+4+d,t],n)),G.add(B([3,a,3],[e-1,r+3+d,t-1],n))}function pond(e,r,t,o){if(G.add(B([e.x,t,e.z],[r.x,r.y,r.z],M.walls)),Math.min(e.x,e.z)>=6){G.add(B([e.x-2,t+.2,e.z-2],[r.x+1,r.y,r.z+1],o)),G.add(B([1,t+.2,e.z-1],[r.x+e.x/2,r.y,r.z-.5],o)),G.add(B([3,t+.2,1],[r.x-.5,r.y,r.z+e.z/2],o));let n=prng(2);pond({x:e.x-3,y:e.y,z:e.z-3},{x:r.x+3*(1-n),y:r.y,z:r.z+3*n},t+2,o)}else if(eth){if(pal>2){let e=B([1,600,1],[r.x+1,r.y,r.z+1],new THREE.MeshPhongMaterial({transparent:!0,opacity:.5,color:10092543,emissive:10092543,emissiveIntensity:2}));G.add(e),lights.push(e)}}else eth=s3D({x:r.x+e.x/2,y:r.y+t+4.2,z:r.z+e.z/2},3,4,2,1.6,new THREE.MeshPhongMaterial({color:ethcol,emissive:ethcol,emissiveIntensity:.2,flatShading:!0})),G.add(eth)}function tenp(e,r){let t=prng(3);for(let o=border;o<e.x-2;o+=2)for(let n,a=border;a<e.z-2;a+=2,n=prng(2))G.add(B([n?2:1,t+1.3,n?1:2],[r.x+o+1.5,r.y,r.z+a+1.5],M.cesped))}function park(e,r){let t=mMz(e.x-border-1,e.z-border-1),o=prng(4);for(let n=border;n<e.x-1;n++)for(let a=border;a<e.z-1;a++)t[n-border][a-border].w&&G.add(B([1,o+1.3,1],[r.x+n+.5,r.y,r.z+a+.5],M.cesped))}function mMz(e,r){let t=new Array(e);for(let e=0;e<t.length;e++){t[e]=new Array(r);for(let o=0;o<r;o++)t[e][o]={w:1,v:0}}mrec(t,e,r,1,1);let o=FL(e/2)+1,n=FL(r/2)+1;return t[0][n].w=0,t[e-1][n].w=0,t[o][0].w=0,t[o][r-1].w=0,t}function mrec(e,r,t,o,n,a=!1){if(o>=0&&n>=0&&o<r&&n<t&&!e[o][n].v){e[o][n].w=0,e[o][n].v=1,a&&(e[o-a[0]][n-a[1]].w=0);let d=[[0,-1],[1,0],[0,1],[-1,0]],i=prng(2);for(let e=0;e<i;e++){let e=prng(3),r=d[e];d[e]=d[e+1],d[e+1]=r}for(let a=0;a<4;a++)mrec(e,r,t,o+2*d[a][0],n+2*d[a][1],d[a])}}function b(e,r,t,o=-1,n=0,a=!0,d=!1){if(n&&G.add(B([e.x+n,n,e.z+n],[r.x-n/2,1+r.y,r.z-n/2],M.walls)),r.y+=n,G.add(B([e.x-2,t+1,e.z-2],[r.x+1,r.y+1,r.z+1],M.core)),-1!=o||prng(rf)?wallP(e,r,t,o):wallR(e,r,t),a&&prng(2)){let o=t<6||!d&&(t<8||prng(2)),n=o?5*prand(1,2):4+prng(4);e.x>e.z?cartel(e.x/(prng(2)&&n<10?1:2),n,[r.x,r.y+t+(o?3:-(n-2)),r.z+(o?.5:-1)],0):cartel(e.z/(prng(2)&&n<10?1:2),n,[r.z,r.y+t+(o?3:-(n-2)),r.x+(o?.5:-1)],1)}!d&&t>10&&prng(2)&&antenna({x:r.x-1,y:r.y+t+3,z:r.z-1},e.z>e.x)}function antenna(e,r){let t=1+prng(4);for(let o=1;o<=t;o++){let t=5+o,n=e.x+2.5*(r?1:o),a=e.z+2.5*(r?o:1);G.add(B([1.5,(1+prng(2))/2,1.5],[n-.5,e.y,a-.5],M.core)),G.add(B([.5,t,.5],[n,e.y,a],M.walls)),G.add(B([.5,1,.5],[n,e.y+t,a],M.neon))}}function cartel(e,r,t,o=0){let n=prng(2)?M.neon:prng(2)?M.neon1:M.neon2;prng(5)||(n=n.clone(),lights.push(n)),G.add(B([e,r,.5],t,M.panel,o)),G.add(B([1,r,1],[t[0]+2,t[1],t[2]+.5],M.panel,o)),G.add(B([1,r,1],[t[0]+e-3,t[1],t[2]+.5],M.panel,o));for(let a=1;a<(e-1)/2;a++)for(let d=1;d<r-1;d++)prng(3)&&(G.add(B([1,1,1],[t[0]+a,t[1]+d,t[2]-.3],n,o)),G.add(B([1,1,1],[t[0]+e-a-1,t[1]+d,t[2]-.3],n,o)))}function wallP(e,r,t,o=-1){let n=M.walls.clone();rainbowWalls&&n.color.set(ethpal[prng(ethpal.length)]);let a=-1==o?pats[prng(pats.length)]:o,d=a[0].length,i=a.length;for(let o=0;o<=t;o++){let t=o||2;for(let l=0;l<e.x/2;l++)a[t%i][l%d]&&(G.add(B([1,1,1],[l+r.x,o+r.y+1,r.z],n)),G.add(B([1,1,1],[r.x+e.x-l-1,o+r.y+1,r.z],n)),l<3&&G.add(B([1,1,1],[l+r.x,o+r.y+1,r.z+e.z-1],n)));for(let l=1;l<e.z/2;l++)a[t%i][l%d]&&(G.add(B([1,1,1],[r.x,o+r.y+1,l+r.z],n)),G.add(B([1,1,1],[r.x,o+r.y+1,r.z+e.z-l-1],n)),l<3&&G.add(B([1,1,1],[r.x+e.x-1,o+r.y+1,l+r.z],n)))}G.add(B([e.x,1,e.z],[r.x,2+r.y+t,r.z],n))}
for(let e=0;e<17;e++){roads[e]=new Array(17);for(let r=0;r<17;r++)roads[e][r]={v:1,d:[]}}var cars=[],ele=[],ppl=0,blinking=!0,rf=-1+prng(30),reduc=1+prng(2);let offs=FL(border/2-1);if(prng(2)&&(mr([gx+4,1,1],[offs,16,offs+gz/2]),train({x:offs+5+prng(gx/2-10),y:15,z:gz/2+offs-1.5},0)),prng(2)&&(mr([1,1,gz+2],[offs+gx/2,8,0]),train({x:offs-1.5+gx/2,y:7,z:offs+15+prng(gz/2-10)},1)),prng(2)){mr([1,1,gz+border],[offs,0,-.1]),train({x:offs-1.5,y:-1,z:offs+15+prng(gz/2-10)},1);for(let e=0;e<17;e++)roads[0][e].v=0}if(prng(2)||rainbow){mr([gx+border,1,1],[-.1,0,offs]),train({x:offs+15+prng(gx/2-10),y:-1,z:offs-1.5},0);for(let e=0;e<17;e++)roads[e][0].v=0}rec({x:gx,y:96,z:gz},{x:0,y:0,z:0}),G.add(B([gx+border,1,gz+border],[0,-.3,0],M.ground));let gh=10,levels=8;for(let e=1;e<=levels;e++)prng(e+1)?rLev(gh,{x:0,y:-gh*e-.3,z:0}):uLev(gh,{x:0,y:-gh*e-.3,z:0});G.add(B([gx+border,500,gz+border],[0,-500-gh*levels-.3,0],M.dirt));let nuc=new THREE.Group;nuc.add(B([gx+border+1e3,400,gz+border+10],[-500,-600-gh*levels-.3,-10],M.water));for(let e=0;e<500;e+=10)nuc.add(B([10,350+5*prng(10),10],[-250+e,-600-gh*levels-.3,-15],M.dirt));G.add(nuc.rotateY(PI/4)),SC.add(B([20,20,20],[-10,380,-50],new THREE.MeshLambertMaterial({color:16768256,emissive:pal>1?16777215:16768256,emissiveIntensity:1}))),dN(tokenId,-1,1.7,gz+border-2,1,!0);const ld=prng(2),l=new THREE.DirectionalLight(16777215,.9);l.position.set(ld?3:-3,4,4),SC.add(l);const l2=new THREE.DirectionalLight(c2s[pal],.2);l2.position.set(ld?-1:1,3,8),SC.add(l2),G.position.set(-cx,0,-cz),city.position.set(0,-60,-800),city.rotation.set(rotX,rotY,0),city.add(G),SC.add(city);var txt="",h=[0];for(let e=0;e<6;e++)h.push(prng(4)?prng(8):0);h.push(0);w=["::",".:",":.",": "," :",". "," .",".."];for(let e=8;e>=0;e--){for(let r=0;r<h.length;r++)txt+=h[r]>e?"|"+(e>0?w[prng(w.length)]:prng(2)?"n_":"__"):(r>0&&e<h[r-1]?"|":e>0?" ":"_")+(h[r]==e?e&&!prng(3)?"_|":"__":prng(6)||e<6?" ":" ~");txt+="\n"}function moveCar(e){for(let r of cars)if(r.x+=r.v*r.d[0]*e,r.z+=r.v*r.d[1]*e,r.model.position.x=(6*r.x+border/2)*grid,r.model.position.z=(6*r.z+border/2)*grid,r.model.rotation.y=1==r.d[0]?PI/2:-1==r.d[0]?-PI/2:-1==r.d[1]?PI:0,ABS(r.x-r.t[0])<=r.v*e&&ABS(r.z-r.t[1])<=r.v*e){r.x=r.t[0],r.z=r.t[1];let e,t=roads[r.t[0]][r.t[1]].d;do{e=roads[r.t[0]][r.t[1]].d[Math.floor(Math.random()*t.length)]}while(t.length>1&&r.d[0]==-e[0]&&r.d[1]==-e[1]);let o=r.d;r.d=e,r.t=[r.x+r.d[0],r.z+r.d[1]],-1==drive?(o[0]==e[1]&&(r.z+=.5*e[1]),o[1]+e[0]==0&&(r.x+=.5*e[0])):(o[0]==-e[1]&&(r.z+=.5*e[1]),o[1]==e[0]&&(r.x+=.5*e[0]))}}txt+="· #"+tokenId+`/449\n· Population: ${ppl}\n·\n· Metropixeland\n· F.Jerez 2022\n`;console.clear();console.log(txt);for(let e=0;e<17;e++)for(let r=0;r<17;r++)roads[e][r].v&&(r<16&&roads[e][r+1].v&&roads[e][r].d.push([0,1]),e>0&&roads[e-1][r].v&&roads[e][r].d.push([-1,0]),r>0&&roads[e][r-1].v&&roads[e][r].d.push([0,-1]),e<16&&roads[e+1][r].v&&roads[e][r].d.push([1,0]));for(let e=0;e<2+3*traffic;e++){let e={x:0,z:0,t:[0,0],d:[0,0],v:.6+prng(6)/10,model:new THREE.Group},r=drive;!bus&&prng(2)?e.model.add(B([2.2,1.5,3],[r-1.1,1.5,-2.1],M.walls)):e.model.add(B([2.1,1,2],[r-1.05,1.5,-1.5],M.neon)),bus?(e.model.add(B([2,4.5,4],[r-1,0,-2],mRW(0))),e.model.add(B([2.1,1,1],[r-1.05,1.5,1.1],M.neon)),e.model.add(B([2.1,1,3.6],[r-1.05,3.2,-1.5],M.neon)),bus=!1):(e.model.add(B([2,2.9,4],[r-1,0,-2],M.vehicle)),e.model.add(B([2.1,1,1],[r-1.05,1.5,1.1],M.neon)));do{e.x=prng(17),e.z=prng(17)}while(0==roads[e.x][e.z].v);e.t=[e.x,e.z],G.add(e.model),cars.push(e)}function rec(e,r){let t=Math.min(e.x,e.z),o=e.x/e.z,n=e.z/e.x;Math.max(o,n)<3&&(t<minrec||t<gx/2&&0==prng(6))?square(e,r):o>.5&&(prng(2)||o>3)?(rec({x:Math.ceil(e.x/2),y:e.y,z:e.z},{x:r.x+FL(e.x/2),y:r.y,z:r.z}),rec({x:Math.ceil(e.x/2),y:e.y,z:e.z},{x:r.x,y:r.y,z:r.z})):(rec({x:e.x,y:e.y,z:Math.ceil(e.z/2)},{x:r.x,y:r.y,z:r.z}),rec({x:e.x,y:e.y,z:Math.ceil(e.z/2)},{x:r.x,y:r.y,z:r.z+FL(e.z/2)}))}function getY(e,r){let t=0;return t=0==r?1.5*e.x-.5*gx:1==r?1.5*e.z-.5*gz:2==r?1.5*Math.max(e.x,e.z)-.5*gz:3==r?Math.min(e.x,e.z):4==r?Math.max(e.x-e.z,e.z-e.x):e.x>=gx/2&&e.z>=gz/2?Math.max(e.x,e.z):0,FL(randFam?prng(t)/reduc:t/reduc)}function square(e,r){let t=border+2,o=Math.min(e.x,e.z),n=2+FL(getY(r,fam));for(let t=1;t<e.x/6;t++){roads[FL(r.x/6+t)][FL(r.z/6+1)].v=0;for(let o=1;o<e.z/6;o++)roads[FL(r.x/6+t)][FL(r.z/6+o)].v=0}if(prng(n)<2&&(n=1),G.add(B([e.x-border+2,1,e.z-border+2],[border+r.x-1,0,border+r.z-1],M.sidewalk)),r.x&&prng(2))for(let t=2.25;t<=4.25;t++)G.add(B([.5,1,2],[r.x+border-t,0,r.z+e.z-1],M.sidewalk));if(r.z&&prng(2))for(let t=2.25;t<=4.25;t++)G.add(B([2,1,.5],[r.x+e.x-1,0,r.z+border-t],M.sidewalk));if(n>1||!prng(6)){ppl+=n*prand(8,12);let a=r.x+e.x/2+border/2+2,d=r.z+e.z/2+border/2+2;if(o>minrec&&e.x!=e.z){let i=Math.round(.6*n),l=Math.round(1*n),s=rPat();b({x:o-t,y:n/2,z:o-t},{x:r.x+t,y:r.y,z:r.z+t},i,s),b({x:o-t,y:n/2,z:o-t},{x:(e.x>e.z?e.x/2:0)+r.x+t,y:r.y,z:(e.z>e.x?e.z/2:0)+r.z+t},i,s,0,!1);let p=e.x/2-border,g=e.z/2-border;b({x:p,y:e.y,z:g},{x:a-p/2,y:r.y+i+4,z:d-g/2},l,-1,2),G.add(B([p+1,i+5,g+1],[a-p/2+.02,r.y,d-g/2+.02],M.core)),G.add(B([2,i+7,2],[a-(g>p?p/2+1:2),r.y,d-(g<p?g/2+1:2)],M.walls))}else{let t=!1;if(o>minrec){t=!0;let o=r.y+n+2.1;G.add(B([7,1,1],[a-5,o,d-4],M.neon)),G.add(B([7,1,1],[a-5,o,d],M.neon)),G.add(B([1,1,3],[a-2,o,d-3],M.neon)),G.add(B([2,1,2],[r.x+border+2,o,r.z+border+2],M.neon3)),G.add(B([2,1,2],[r.x+e.x-border+2,o,r.z+border+2],M.neon3)),G.add(B([2,1,2],[r.x+border+2,o,r.z+e.x-border+2],M.neon3)),G.add(B([2,1,2],[r.x+e.x-border+2,o,r.z+e.z-border+2],M.neon3)),n>12&&!gotHeli?heli({x:a-2,y:r.y+n+3.5,z:d-2}):pond({x:e.x-border-3,y:e.y,z:e.z-border-3},{x:r.x+border+1.5,y:r.y+n+2,z:r.z+border+1.5},2,M.core),gotHeli=!0}else if(n>30&&!prng(2)&&e.x>e.z){for(let e=3;e>=1.5;e-=1.5)G.add(B([1,n+3,.5],[r.x+border-.2,r.y,d-e],M.walls,0));let e={miny:2*grid,maxy:n*grid,delay:0,stop:2+prng(4),dir:prng(2)?-5:5,model:new THREE.Group};e.model.position.set((r.x+border-1.5)*grid,(4+prng(n-6))*grid,(d-3)*grid),e.model.add(B([1.5,2,1.6],[0,0,.2],M.core,0)),e.model.add(B([1.5,.3,2],[0,2,0],M.walls,0)),e.model.add(B([1.5,1,2],[0,-1,0],M.walls,0)),ele.push(e),G.add(e.model)}b({x:e.x-border,y:e.y,z:e.z-border},{x:r.x+border,y:r.y,z:r.z+border},n,-1,0,!0,t)}}else if(Math.min(e.x,e.z)<minrec)for(let t=border+1;t<Math.max(e.x,e.z);t+=5){let o=e.x>e.z?r.x+t:r.x+(e.x+border)/2-1,n=e.x>e.z?r.z+(e.z+border)/2-1:r.z+t;tree(o,r.y,n)}else prng(2)||e.x!=e.z?prng(2)?park(e,r):tenp(e,r):pond({x:e.x-border,y:e.y,z:e.z-border},{x:r.x+border,y:r.y,z:r.z+border},2,M.water)}function mr(e,r){let t=e[2]>1;if(G.add(B(e,r,M.rail)),r[1]>0)for(let e=5;e<=110;e+=24)monoarc([t?r[0]:Math.min(e,94),r[1],t?Math.min(e,95):r[2]],t)}function monoarc(e,r=!1){let t=M.rail,o=e[1],n=r?3:0,a=r?0:3;G.add(B([3,1,3],[e[0]+n-.85*n,e[1]-1,e[2]+a-.85*a],t)),G.add(B([r?1:3,o-1,r?3:1],[e[0]+n,0,e[2]+a],t)),G.add(B([1,o-1.1,1],[e[0]+n+(r?-.25:1),0,e[2]+a+(r?1:-.25)],M.neon))}function mRW(e){return new THREE.MeshLambertMaterial({color:ethpal[e]})}function train(e,r=0){let t=rainbow?5:prand(3,6),o=new THREE.Group,n=M.neon.clone();if(r){for(let r=0;r<t;r++)o.add(B([2,2,6],[e.x+1,e.y+2.7,6.5*r],rainbow?mRW(2*r):M.vehicle)),o.add(B([1,.8,4.5],[e.x+.7,e.y+3.5,6.5*r+.5],M.neon));o.add(B([1.5,2,6.5*t+.5],[e.x+1.3,e.y+1.7,-.5],n)),o.position.z=e.z*grid}else{for(let r=0;r<t;r++)o.add(B([6,2,2],[6.5*r,e.y+2.7,e.z+1],rainbow?mRW(2*r):M.vehicle)),o.add(B([4.5,.8,1],[6.5*r+.5,e.y+3.5,e.z+.7],M.neon));o.add(B([6.5*t+.5,2,1.5],[-.5,e.y+1.7,e.z+1.3],n)),o.position.x=e.x*grid}trains.push({z:r,t:o,v:prand(10,16)*(prng(2)?1:-1),l:6.5*t,d:0,m:n,w:!0,broken:prand(20,120)}),G.add(o),rainbow=!1}function dN(e,r,t,o,n,a=!1){let d=tokenId,i=0;do{let e=numbers[d%10],l=new THREE.Group,s=M.neon;blinking&&!prng(3)&&(s=s.clone(),lights.push(s),blinking=!1);for(let d=0;d<15;d++)1&e&&l.add(B([n,n,n],[a?r-.2:r+i+n*(d%3),t+2+n*FL(d/3),a?o-(i+n*(d%3)):o+.7],s,0)),e>>=1;G.add(l),i+=4*n,d=FL(d/10)}while(d>0);G.add(B([1,7,i+1],[r,t+1,o-i+1],M.panel,0)),G.add(B([1,9,1],[r+1,t-1,o-i+3],M.panel,0)),G.add(B([1,9,1],[r+1,t-1,o-1],M.panel,0))}
const hash=tokenData.hash,tokenId=Math.min(449,tokenData.tokenId%1000),PI=Math.PI,TC=THREE.Color,FL=Math.floor,ABS=Math.abs,xS=Uint32Array.from([0,0,0,0].map((e,r)=>parseInt(hash.substring(8*r+2,8*r+10),16))),prng=e=>{let r,t=xS[3];return xS[3]=xS[2],xS[2]=xS[1],xS[1]=r=xS[0],t^=t<<11,t^=t>>>8,xS[0]=t^r^r>>>19,FL(e*(xS[0]/4294967296))},prand=(e,r)=>e+prng(r-e);const V2=(x,y)=>new THREE.Vector2(x,y);var palette=!prng(6),palnumber=prng(7),rainbowWalls=!palette&&!prng(40),sakuraTrees=!prng(16),randTrees=!sakuraTrees&&!prng(4),drive=prng(3)?-1:1,bus=1==drive&&!prng(3),rainbow=!prng(14),traffic=prng(4);const vertexShader="precision highp float;attribute vec2 position;void main(){gl_Position=vec4(position,1.,1.);}",fragmentShader="precision highp float;uniform sampler2D uScene;uniform vec2 uResolution;\nfloat random(vec2 p){return fract(cos(dot(p,vec2(23.14,2.665)))*12345.6789);}void main(){vec2 uv=gl_FragCoord.xy/uResolution.xy;vec4 color=texture2D(uScene,uv);float step_u=1./uResolution.x;float step_v=1./uResolution.y;vec4 cRight=texture2D(uScene,uv+vec2(step_u,0.));vec4 cBottom=texture2D(uScene,uv+vec2(0.,step_v));float _dFdx=length(color-cRight)/step_u;float _dFdy=length(color-cBottom)/step_v;\nfloat g=sqrt(pow(_dFdx,2.)+pow(_dFdy,2.))*.006;if(g>.4 && uResolution.x>350.)color.rgb*=max(.5,1.-(uResolution.x-350.)/500.);color.rgb*=1.1-.8*(sqrt(pow(.5-uv.x,2.)+pow(.5-uv.y,2.)));vec2 uvRandom=uv;uvRandom.y*=random(vec2(uvRandom.y,1.));color.rgb+=random(uvRandom)*.06;gl_FragColor=color;}";class FX{constructor(e){this.r=e,this.s=new THREE.Scene,this.dC=new THREE.Camera,this.r.setPixelRatio(window.devicePixelRatio),this.r.antialias=!1,this.res=new THREE.Vector2,this.t=new THREE.WebGLRenderTarget(this.res.x,this.res.y,{format:THREE.RGBAFormat,stencilBuffer:!1,depthBuffer:!0}),this.m=new THREE.RawShaderMaterial({fragmentShader:fragmentShader,vertexShader:vertexShader,uniforms:{uScene:{value:this.t.texture},uResolution:{value:this.res}}}),this.p=new THREE.Mesh(new THREE.PlaneBufferGeometry(2,2),this.m),this.p.frustumCulled=!1,this.s.add(this.p),this.resize()}resize(){this.r.getDrawingBufferSize(this.res),this.m.uniforms.uResolution.value=this.res,this.t.setSize(this.res.x,this.res.y)}render(e,r){this.r.setRenderTarget(this.t),this.r.clear(),this.r.render(e,r),this.r.setRenderTarget(null),this.r.render(this.s,this.dC)}}var clock=new THREE.Clock,width=window.innerWidth,height=window.innerHeight;const R=new THREE.WebGLRenderer({premultipliedAlpha:!1,alpha:!0});R.autoClear=!1,R.setPixelRatio(window.devicePixelRatio),R.setSize(width,height),document.body.appendChild(R.domElement);const SC=new THREE.Scene;var tex1=new THREE.Texture(generateTexture());tex1.needsUpdate=!0,tex1.anisotropy=R.capabilities.getMaxAnisotropy(),tex1.wrapT=tex1.wrapS=THREE.RepeatWrapping;var w=.1+prng(10)/40,m=new THREE.ShaderMaterial({uniforms:{wind:{value:prng(2)?w:-w},cycle:{value:0},c1:{value:0},c2:{value:0},dt:{value:prng(1e3)}},vertexShader:"precision highp float;varying vec2 vUv;void main(){vUv=uv;gl_Position=vec4(position,1.);}",fragmentShader:"precision highp float;uniform sampler2D uScene;uniform float wind;uniform float dt;uniform float cycle;varying vec2 vUv;uniform vec3 c1,c2;float hash(float n){return fract(sin(n)*758.5453);}float noise(in vec3 x){vec3 p=floor(x);vec3 f=fract(x);float n=p.x+p.y*57.+p.z*800.;float res=mix(mix(mix(hash(n+0.),hash(n+1.),f.x),mix(hash(n+57.),hash(n+ 58.),f.x),f.y),mix(mix(hash(n+800.),hash(n+801.),f.x),mix(hash(n+857.),hash(n+858.),f.x),f.y),f.z);return res;}float fbm(vec3 p){float f=.5*noise(p);p*=1.39+cycle;for(float i=.25;i>.03;i/=2.){f+=i*noise(p);p*=2.02;}return f;}float borealCloud(vec3 p){p+=fbm(vec3(p.x,p.y,0.0)*0.5)*2.25;float a=smoothstep(.0,.9,fbm(p*2.)*2.2-1.1);return clamp(a,0.,1.);}void main(){float sp=dt*.1;vec4 color=vec4(mix(c1,c2,1.-vUv.y),1.);if(cycle>2.) color.g+=(borealCloud(vec3(vUv.x,vUv.y*.27,sp*.5))*clamp(2.*(vUv.y-(.5+.1*cos((vUv.x+sp)*6.))),0.,1.)); else color+=borealCloud(vec3(vUv.x+sp*wind,vUv.y*1.5,sp*wind*2.))*clamp((vUv.y-.5)*2.,0.,1.);gl_FragColor=color;}"}),bgplane=new THREE.Mesh(new THREE.PlaneGeometry(2,2),m);SC.add(bgplane);const ethpal=[16711680,16746240,16765696,14614282,10616586,720793,716799,1342965,5769983,12454655],ethcol=ethpal[prng(10)],c1s=[5942001,873670,1516381,331314],c2s=[16755200,6931446,15108792,3488657],pal=setBG(tokenId);function setBG(e){let r=[0,27,90,247,292,315,337,450],t=0;for(;e>=r[t];)t++;let o=FL(t/2),n=FL((t-1)/2),a=(e-r[t-1])/(r[t]-r[t-1]);return m.uniforms.c1.value=new TC(c1s[n]).lerp(new TC(c1s[o]),a),m.uniforms.c2.value=new TC(c2s[n]).lerp(new TC(c2s[o]),a),m.uniforms.cycle.value=o,o}const palettes=[[16777215,65484,10263708,13421772,16777215],[5263955,16777215,8350828,9144713,10658713],[46079,16514816,6984879,7517135,9356237],[10481022,15728257,5073487,7647099,11989670],[16724818,13225378,12605785,13343888,14393247],[16769858,16774072,9935176,12565583,13223227],[13191836,15007150,13071576,16692464,15119332]];var citypal=palettes[palnumber],numbers=[31599,9362,29671,29391,23497,31183,31215,29257,31727,31695],pats=new Array,numpat=1+5*prng(4);for(let e=0;e<numpat;e++)pats.push(randPat(6,6+3*prng(4),prng(3)));function randPat(e,r,t=1){let o=new Array(r);for(let t=0;t<r;t++)o[t]=new Array(e);if(t)for(let t=0;t<r;t+=3)for(let r=0;r<e;r++){o[t][r]=1;let e=r%2||prng(4)?0:1;o[t+1][r]=o[t+2][r]=e}else for(let t=0;t<r;t++)for(let r=0;r<e;r+=3){o[t][r]=1;let e=t%2&&!prng(2)?1:0;o[t][r+1]=o[t][r+2]=e}return o}var rPat=()=>pats[prng(pats.length)];const MLM=(e=0)=>new THREE.MeshLambertMaterial({color:0,emissive:0==e?0:16777215,emissiveIntensity:e});var M={walls:MLM(),dirt:MLM(),ground:MLM(),water:MLM(.02),core:MLM(.8),sidewalk:MLM(),vehicle:MLM(),rail:MLM(),panel:MLM(.4),neon:MLM(2),neon1:MLM(2),neon2:MLM(2),tree1:MLM(),tree2:MLM(),tree3:MLM(.15),cesped:MLM()};M.water.map=tex1;const COL=(e,r,t)=>new TC("hsl("+e+", "+r+"%,"+t+"%)");randColors();var rainbowRocks=!1;function randColors(){for(const e in M)M[e].color.set(prng(16777215));M.walls.color.set(COL(prand(50,360)+130,prand(20,60),prand(50,70))),M.core.color.set(COL(prand(10,100),prand(20,50),prand(50,95)));let e=prng(330);M.sidewalk.color.set(COL(e+20,15,60)),M.ground.color.set(COL(e,5,50)),e=prng(360),M.vehicle.color.set(COL(e,100,65)),M.rail.color.set(COL(e,100,80)),M.dirt.color.set(COL(prand(30,100),prand(30,80),80)),M.water.color.set(COL(prand(140,210),100,50)),M.tree1.color.set(COL(prng(60),100,40)),M.tree2.color.set(COL(prand(60,165),100,prand(40,70))),M.tree3.color.set(COL(320,100,60)),M.cesped.color.set(COL(prand(75,165),100,prand(40,70))),M.neon.color.set(COL(0,0,100));let r=prand(10,200);M.neon.emissive.set(COL(r,100,FL(50+10*Math.cos(3*r*PI/180)))),M.neon1.emissive.set(COL(prng(360),100,prand(30,60))),M.neon2.emissive.set(COL(prng(360),100,prand(30,60))),M.core.emissive.set(COL(prand(30,210),90,prand(80,100)))}palette&&(rainbowRocks=5==palnumber,M.walls.color.set(citypal[0]),M.core.color.set(citypal[1]),M.ground.color.set(citypal[2]),M.sidewalk.color.set(citypal[3]),M.dirt.color.set(citypal[4]));var post=new FX(R);const C=new THREE.OrthographicCamera(width/-2,width/2,height/2,height/-2,1e-4,1e4);var scale=350;C.zoom=Math.min(width,height)/scale,C.updateProjectionMatrix();var H,eth,RX=PI/6,RY=.75*PI,rotX=RX,rotY=RY,G=new THREE.Group,city=new THREE.Group,grid=2.15,gx=96,gz=96,cx=gx*grid*.5,cz=gz*grid*.5,border=6,minrec=15,gotHeli=!1,rtrees=prng(2),fam=prng(6),randFam=prng(2),lights=[],trains=[],roads=new Array(17);
**"A nice place to live if you are made of pixels"** As digital beings, we have been playing, working, making friends in a virtual world for many years. Metropixeland is a vibrant metropolis where our pixels can live in peace. Enjoy a relaxing experience with nostalgic vibes. Learn more in the project site. ~ __ ~ ~ |::| ~ ~ __ __ |::| |..| .| __| :| ___|n_|__|__|n_|__|_____ **Interaction** **Click & Drag** mouse for camera control. **Keys: 1,2,3** changes to different 2D projections. Any other key or mouse-click goes back to Isometric. **Key '0' (zero)** swaps between transparent background and default sky. Useful for screenshoting and editing.
Nine factions populate the virtual space. While Utopians develop the main net, the others work on their nodes building an economy system over the secondary chains. Each station is focusing on one activity but there’s some dangers out there: Scammers and Hackers trying to survive doing obscure things. There are also some drafts and blueprints of stations waiting for a faction to buy and build them. Who knows what its final purpose will be. This project plays with procedural architectonic structures. I’m using a sci-fi style to present a virtual world populated by space station-like structures. Use Mouse to Control the Camera. Click: Stop Rotation. Double Click: Reset Auto Rotation. Press Any Key to Change Background Mode. Space -> Stripped -> Fog -> Transparent
function CR(e,t,o){o.y>mY&&(mY=o.y);let r,n=Math.min(t.x,t.z),a=.05*n,i=nC(),s=nC();if(n>.2){e.add(circle3D({x:t.x-a,y:t.y,z:t.z-a},o));let c=prng(18);if(rec&&n<.8*w&&0==c){mY+=.6*n;let r=ring3D(4+prng(5),.5*n,1,h,1,1);r.position.set(o.x,o.y+t.y+.5*n,o.z),e.add(r),e.add(tr3D({x:.6*n,y:.5*n,z:.6*n},{x:o.x,y:o.y+t.y,z:o.z})),e.add(tr3D({x:.8*n,y:.3*n,z:.8*n},{x:o.x,y:o.y+t.y,z:o.z}))}else{do{c=getOption(optCir)}while(3==c&&n>w);switch(c){case 0:CR(e,{x:t.x-a,y:t.y,z:t.z-a},{x:o.x,y:o.y+t.y,z:o.z});break;case 1:let d=.38*n,y={x:.2*n,y:t.y,z:.2*n};BR(e,{x:.55*n,y:t.y,z:.55*n},{x:o.x,y:o.y+t.y,z:o.z}),CR(e,y,{x:o.x+d,y:o.y+t.y,z:o.z}),CR(e,y,{x:o.x-d,y:o.y+t.y,z:o.z}),CR(e,y,{x:o.x,y:o.y+t.y,z:o.z+d}),CR(e,y,{x:o.x,y:o.y+t.y,z:o.z-d});break;case 2:let l=2+prng(6),x=.42*n,p={x:.12*n,y:t.y,z:.12*n};CR(e,p,{x:o.x+x,y:o.y+t.y,z:o.z}),CR(e,p,{x:o.x-x,y:o.y+t.y,z:o.z}),CR(e,p,{x:o.x,y:o.y+t.y,z:o.z+x}),CR(e,p,{x:o.x,y:o.y+t.y,z:o.z-x});for(let r=0;r<l;r++){let a=.96*n/Math.sqrt(r/2+1);e.add(box3D({x:.66*a,y:t.y,z:.66*a},{x:o.x,y:o.y+t.y*(r+1),z:o.z}))}CR(e,{x:.75*n,y:t.y,z:.75*n},{x:o.x,y:o.y+t.y*(l+1),z:o.z});break;case 3:r=.31*(n-=a),o.y+=t.y,CR(e,{x:.82*n,y:t.y,z:.82*n},{x:o.x,y:o.y+.2*n,z:o.z}),e.add(tr3D({x:.67*n,y:.2*n,z:.67*n},{x:o.x,y:o.y,z:o.z}));for(let t=0;t<2*PI;t+=PI/4)e.add(tr3D({x:.25*n,y:.1*n,z:.25*n},{x:o.x+r*Math.cos(t),y:o.y,z:o.z+r*Math.sin(t)},i)),e.add(tr3D({x:.2*n,y:.2*n,z:.2*n},{x:o.x+r*Math.cos(t),y:o.y,z:o.z+r*Math.sin(t)},s))}}}}function box3D(e,t,o=-1){let r=new THREE.Mesh(new THREE.BoxGeometry(e.x,e.y,e.z),new THREE.MeshPhongMaterial({color:o<0?nC():o,flatShading:!0,map:tex1}));return r.position.set(t.x,t.y+.5*e.y,t.z),r}function circle3D(e,t,o=60){let r=.5*Math.min(e.x,e.z);60==o&&(o=80*r);let n=new THREE.Mesh(new THREE.CylinderGeometry(r,r,e.y,o),new THREE.MeshPhongMaterial({color:nC(),flatShading:!0,map:tex2}));return n.position.set(t.x,t.y+.5*e.y,t.z),n}function tr3D(e,t,o=-1){let r=.5*Math.min(e.x,e.z),n=new THREE.Mesh(new THREE.CylinderGeometry(.25*r,r,e.y,4),new THREE.MeshPhongMaterial({color:o<0?nC():o,flatShading:!0,map:tex1}));return n.rotateY(PI/4),n.position.set(t.x,t.y+.5*e.y,t.z),n}function gT(e=0){var t=512,o=document.createElement("canvas");o.width=o.height=t;var r=o.getContext("2d"),n=r.createImageData(t,t);for(let t=0;t<n.data.length;t+=4){let o=2==e?prng(200)?10:10+prng(246):neg?90:200;bp&&(o=200),n.data[t+0]=n.data[t+1]=n.data[t+2]=o,n.data[t+3]=255}return r.putImageData(n,0,0),bp||(r.lineWidth=e?neg?20:6:neg?100:12,r.strokeStyle=neg?"#FFFFFF":"#000000cc",e?1==e&&(r.beginPath(),r.arc(256,256,256,0,2*PI),r.stroke()):(r.rect(0,0,t,t),r.stroke(),neg||(r.strokeStyle="#00000033",r.rect(60,60,392,392),r.stroke()))),o}var mouseD=!1,mH=0,yDir=1;function changeBG(){bp?(SP.visible=!1,SH.visible=!1,S.fog=null):(bgmode=(bgmode+1)%4,S.fog=2==bgmode?theFog:null,SP.visible=0==bgmode||2==bgmode,SH.visible=1==bgmode,R.setClearColor(0,bgmode==3?0:1))}function A(){let e=clock.getDelta();mH+=e,R.domElement.style.cursor=mH>3?"none":"default",e<.3&&(RX+=dX*e,RY+=dY*e,G.rotation.x+=(RX-G.rotation.x)/9,G.rotation.y+=(RY-G.rotation.y)/9,C.position.z+=(Cp-C.position.z)/9),PP.render(S,C),requestAnimationFrame(A)}document.addEventListener("keypress",e=>{changeBG()}),document.addEventListener("mousedown",e=>{mouseD=!0,dX=dY=0,yDir=Math.sign(Math.cos(RX))}),document.addEventListener("mouseup",e=>{mouseD=!1},!1),document.addEventListener("wheel",e=>{Cp=Math.max(Math.min(Cp*(1+7e-4*e.deltaY),5*w),5)}),document.addEventListener("mousemove",e=>{mH=0,mouseD&&(RX+=.005*e.movementY,RY+=e.movementX*yDir*.005,dX=.01*e.movementY,dY=e.movementX*Math.cos(RX)*.01)}),document.addEventListener("dblclick",e=>{Cp=2.5*w,dX=core?-.025:.025,dY=.05},!1),window.addEventListener("resize",()=>{let e=window.innerWidth,t=window.innerHeight;C.aspect=e/t,C.updateProjectionMatrix(),R.setSize(e,t),PP.resize()},!1),A();
const vSh="precision highp float;attribute vec2 position;void main(){gl_Position=vec4(position,1.,1.);}",fSh="precision highp float;uniform sampler2D uScene;uniform vec2 uResolution;uniform float core,a,bp,bpmode;float random(vec2 p){return fract(cos(dot(p,vec2(23.4069263277926,2.665144142690225)))*43758.5453123)-.5;}vec4 getCol(vec2 pos){return texture2D(uScene,pos/uResolution.xy);}void pR(inout vec2 p,float a){p=cos(a)*p+sin(a)*vec2(p.y,-p.x);}float getVal(vec2 pos){return dot(getCol(pos).xyz,vec3(.2126,.7152,.0722));}vec2 getGrad(vec2 pos,float eps){vec2 d=vec2(eps,0);return vec2(getVal(pos+d.xy)-getVal(pos-d.xy),getVal(pos+d.yx)-getVal(pos-d.yx))/eps/2.;}void main(){vec2 uv=gl_FragCoord.xy/uResolution.xy;vec4 color=texture2D(uScene,uv);float step_u=1./uResolution.x;float step_v=1./uResolution.y;vec4 cRight=texture2D(uScene,uv+vec2(step_u,.0));vec4 cBottom=texture2D(uScene,uv+vec2(.0,step_v));float _dFdx=.0002*length(color-cRight)/step_u;float _dFdy=.0002*length(color-cBottom)/step_v;float g=sqrt((pow(_dFdx,2.)+pow(_dFdy,2.)));float rng;vec3 c,c1,c2,c3;if(bp>0.){if(bpmode==0.){c=vec3(.9,.9,.99);c1=vec3(.21,.36,.63);c2=vec3(.15,.27,.5);c3=vec3(.04,.19,.36);}else{c= vec3(.4,.4,.4);c1=vec3(.7,.7,.7);c2=vec3(.75,.75,.75);c3=vec3(.9,.84,.72);}color-=g*5.;_dFdx=.0006*length(color-cRight)/step_u;_dFdy=.0006*length(color-cBottom)/step_v;g=sqrt((pow(_dFdx,2.)+pow(_dFdy,2.)));if(g>.05){color=vec4(mix(c,c3,.15),.1);}else{float mx,my,mx1,my1;if(bp==1.){mx=my1=0.;my=mx1=2.;}else{mx=mx1=1.;my=my1=1.5;}if(mod(gl_FragCoord.x*mx+gl_FragCoord.y*my,160.)<1.5||mod(gl_FragCoord.y*my1-gl_FragCoord.x*mx1,160.)<1.5){color.rgb=c1;}else if(mod(gl_FragCoord.x*mx+gl_FragCoord.y*my,40.)<1.5||mod(gl_FragCoord.y*my1-gl_FragCoord.x*mx1,40.)<1.5){color.rgb=c2;}else{color.rgb=c3;}}rng=1.;}else{color-=g*.5;if(core>0.0) color.rgb/=max(.6,min(1.,.6*core*(sqrt(abs(.5-uv.x)+abs(.5-uv.y)))));color.rgb*=max(.7,mod(floor(uv.y*uResolution.y),2.));rng=a;color.rgb*=1.7-.8*(sqrt(pow(.5-uv.x,2.)+pow(.5-uv.y,2.)));}if(bp>=0.){vec2 pos=gl_FragCoord.xy;float we=1.;for (float j=0.;j<8.;j+=1.){vec2 dir=vec2(1.,0.);pR(dir,j*6.283185/(2.*8.));vec2 grad=vec2(-dir.y,dir.x);for(float i=-6.;i<=6.;i+=2.){vec2 pos2=pos+normalize(dir)*i;vec2 g=getGrad(pos2,1.);if (length(g)>.01) we-=pow(abs(dot(normalize(grad),normalize(g))),8.)/floor((2.*6.+1.)/2.)/8.;}}vec4 bg=mix(color,vec4(1),.01);color=mix(vec4(c,1.),bg,we);}vec2 uvRandom=uv;uvRandom.y*=random(vec2(uvRandom.y,rng));color.rgb+=random(uvRandom)*.08;gl_FragColor=clamp(color,0.,1.);}";class Shader{constructor(e){this.ct=0,this.re=e,this.s=new THREE.Scene,this.dC=new THREE.Camera,this.g=new THREE.PlaneBufferGeometry(2,2),this.res=new THREE.Vector2,this.t=new THREE.WebGLRenderTarget(this.res.x,this.res.y,{format:THREE.RGBAFormat,stencilBuffer:!1,depthBuffer:!0}),this.m=new THREE.RawShaderMaterial({fragmentShader:fSh,vertexShader:vSh,uniforms:{uScene:{value:this.t.texture},uResolution:{value:this.res},a:{value:0},core:{value:0},bp:{value:bp},bpmode:{value:bp1}}}),this.p=new THREE.Mesh(this.g,this.m),this.p.frustumCulled=!1,this.s.add(this.p),this.resize()}resize(){this.re.getDrawingBufferSize(this.res),this.m.uniforms.uResolution.value=this.res,this.t.setSize(this.res.x,this.res.y)}render(e,t){this.ct+=.001,this.m.uniforms.core.value=core?3+Math.sin(20*this.ct):0,this.m.uniforms.a.value=this.ct,this.m.uniforms.bp.value=bp,this.m.uniforms.bpmode.value=bp1,this.re.setRenderTarget(this.t),this.re.clear(),this.re.render(e,t),this.re.setRenderTarget(null),this.re.render(this.s,this.dC)}}const PI=Math.PI,xS=Uint32Array.from([0,0,0,0].map((e,t)=>parseInt(tokenData.hash.substr(8*t+2,8),16))),prng=e=>{let t,o=xS[3];return xS[3]=xS[2],xS[2]=xS[1],xS[1]=t=xS[0],o^=o<<11,o^=o>>>8,xS[0]=o^t^t>>>19,Math.floor(e*(xS[0]/4294967296))};var W=window.innerWidth,H=window.innerHeight,clock=new THREE.Clock,mY=0,w=4.5,bp=prng(12)?0:prng(3),bp1=prng(2);const R=new THREE.WebGLRenderer({premultipliedAlpha: false,alpha:!bp});R.autoClear=!0,R.setPixelRatio(window.devicePixelRatio),R.setSize(W,H),document.body.appendChild(R.domElement);const S=new THREE.Scene,L=new THREE.DirectionalLight(16777215,1);if(L.position.set(-1,2,4),S.add(L),bp){const e=new THREE.DirectionalLight(16777215,1);e.position.set(1,-2,-4),S.add(e)}const C=new THREE.PerspectiveCamera(72,W/H,.1,1e3);var Cp=2.4*w;C.position.z=Cp;var neg=!prng(12);const corec=[13421772,13369344,52224,204,13421568,13369548,52428],CL=[[16777215,16777215,15658734,14540253,2236962],[1048619,2359366,3934572,5904538,8072383,10309341,13073919,14723839],[16244937,16108707,15841407,14582843,10505752,12868893],[3712768,3266627,4128651,16777212,16719982],[790282,16719982,16514834,4319956,16777215],[7864320,12653087,16642261,12361,6724540],[0,1319229,16556817,15066597,16777215],[9358054,2203324,143431,16758531,16483584],[723210,1448477,6686472,10753562,15022139,11642790,16118772,16777215]];var sides,ring,core,stick,dX,dY,singleRing,pal,ncols,dome,corenum;sides=3+prng(4),ring=0==prng(4),core=ring&&0==prng(3),stick=0==prng(6),dX=core?-.025:.025,dY=.05,pal=bp?3:ring&&core&&0==prng(3)?0:1+prng(CL.length-1),singleRing=0==prng(2),ncols=CL[pal].length;let thick=.25+.25*prng(4);dome=(ring||core)&&!prng(3),corenum=prng(pal?ncols:7);var cc=0==pal?corec[corenum]:CL[pal][corenum],cnum=0;let rC=()=>CL[pal][prng(ncols)],nC=()=>CL[pal][++cnum%ncols],bgcol=rC();const theFog=new THREE.Fog(bgcol,w*(core?2.1:1.8),w*(core?3.1:3));S.fog=null;var p=8,optBox=[prng(p),prng(p),prng(p),prng(p),prng(p),prng(p)],optCir=[prng(p),prng(p),prng(p),prng(p)];function getOption(e){for(var t=prng(20),o=0,r=0,n=0;o<t&&n<50;)o+=e[r],r=(r+1)%e.length,n++;return r}var tex1=new THREE.Texture(gT(0)),tex2=new THREE.Texture(gT(1)),tex3=new THREE.Texture(gT(2));tex1.needsUpdate=tex2.needsUpdate=tex3.needsUpdate=!0,tex1.wrapT=tex1.wrapS=tex3.wrapT=tex3.wrapS=THREE.RepeatWrapping,tex1.anisotropy=tex2.anisotropy=tex3.anisotropy=R.capabilities.getMaxAnisotropy(),tex1.repeat.set(4,1),tex3.repeat.set(4,2);var rec=!0;const G=new THREE.Group;let h=.08;ring||1!=thick||(w=3.5),ring?core?(singleRing?G.add(dRing(16,1.1*w,.8,h)):(G.add(dRing(22,1.1*w,.7,h)),G.add(dRing(22,1.102*w,.7,h).rotateX(PI/2))),S.add(new THREE.PointLight(cc,.5,1.1*w,.1)),bp||G.add(s3D(.38*w,4,2,.85,1.7,cc)),!bp&&dome&&G.add(s3D(1.1*w,40,40,.35,1,cc,!1))):(G.add(ring3D(20,w,.9,h,1,2)),!bp&&mY<w&&G.add(s3D(w,40,40,.35,1.2,-1,!1))):stick?G.add(ring3D(sides,.35*w,6,h,1,2).rotateX(PI/2)):G.add(ring3D(sides,w,thick,h,1,2));var SP=new THREE.Mesh(new THREE.SphereGeometry(120,20,20),new THREE.MeshBasicMaterial({color:16777215,side:THREE.BackSide,map:tex3})),SH=new THREE.Mesh(new THREE.SphereGeometry(125,250,25),new THREE.MeshPhongMaterial({color:bgcol,side:THREE.BackSide,flatShading:!0}));G.add(SP),G.add(SH);var bgmode=prng(3)-1;changeBG();S.add(G);var RX=PI/(prng(2)?5:-5),RY=PI/(prng(2)?4:-4);G.rotation.x=RX;G.rotation.y=RY;const PP=new Shader(R);function dRing(e,t,o,r){let n=new THREE.Group;return n.add(ring3D(e,t,o,r,1)),rec=!1,n.add(ring3D(e,t,o,r,-1)),rec=!0,n}function s3D(e,t,o,r=1,n,a=-1,i=!0){let s=new THREE.Mesh(new THREE.SphereGeometry(e,t,o),new THREE.MeshPhongMaterial({color:a<0?rC():a,flatShading:i,transparent:1!=r,opacity:r}));return s.scale.set(1,n,1),s}function ring3D(e,t,o,r,n=1,a=!1,i=1){let s=new THREE.Group,c=new THREE.Group,d=new THREE.Group,y=2*t*Math.sin(PI/e),l=y/(2*Math.tan(PI/e)),x=0,p=prng(2);for(let g=PI/e;g<2*PI;g+=2*PI/e){let h=new THREE.Group;if(BR(h,{x:y,y:r,z:y*o*(x++%2?1:1.01)},{x:0,y:0,z:0}),h.rotateY(g),h.rotateX(PI/2),h.translateY(l*n*i),d.add(h),p&&a&&4!=e){let n=.66*(t-l);CR(s,{x:n,y:r,z:n},{x:(t-n)*Math.sin(g+PI/e),y:y*o*.5*i,z:(t-n)*Math.cos(g+PI/e)}),CR(c,{x:n,y:r,z:n},{x:(t-n)*Math.sin(g+PI/e),y:y*o*.5*i,z:(t-n)*Math.cos(g+PI/e)}),c.rotateY(PI)}}if(a){let n=new THREE.Mesh(new THREE.CylinderGeometry(t*i,t*i,y*o*i,e),new THREE.MeshPhongMaterial({color:rC(),flatShading:!0,map:tex2}));d.add(n);let x={x:2*l,y:r,z:2*l},p={x:0,y:y*o*.5*i,z:0};4!=e?(CR(s,x,p),2==a&&CR(c,x,p)):(BR(s,x,p),2==a&&BR(c,x,p),s.rotateY(PI/e),c.rotateY(PI/e)),c.rotateX(PI),d.add(s),2==a&&d.add(c)}return 1==a?(d.translateY(y*o*.45),(new THREE.Group).add(d)):d}function BR(e,t,o){o.y>mY&&(mY=o.y);let r=t.y,n=.1,a=Math.min(t.x,t.z),i=2*a;if(a>.15){let s=getOption(optBox);if(e.add(box3D(t,o)),s>=4){let n=nC(),s=a/3,c={x:1.1*s,y:t.y*i,z:1.1*s};e.add(box3D({x:.63*a,y:t.y*(i-1),z:.63*a},{x:o.x,y:o.y+t.y,z:o.z})),e.add(box3D({x:.77*a,y:r+.01,z:.77*a},{x:o.x,y:o.y+r*i,z:o.z}));for(let r=0;r<4;r++)e.add(tr3D(c,{x:o.x+(r<2?s:-s),y:o.y+t.y,z:o.z+(r%2==1?s:-s)},n))}switch(s){case 0:BR(e,{x:t.x-n,y:t.y,z:t.z-n},{x:o.x,y:o.y+t.y,z:o.z});break;case 1:BR(e,{x:.5*t.x-n,y:t.y,z:t.z-n},{x:o.x+.25*t.x,y:o.y+t.y,z:o.z}),BR(e,{x:.5*t.x-n,y:t.y,z:t.z-n},{x:o.x-.25*t.x,y:o.y+t.y,z:o.z});break;case 2:BR(e,{x:t.x-n,y:t.y,z:.5*t.z-n},{x:o.x,y:o.y+t.y,z:o.z+.25*t.z}),BR(e,{x:t.x-n,y:t.y,z:.5*t.z-n},{x:o.x,y:o.y+t.y,z:o.z-.25*t.z});break;case 3:CR(e,t,{x:o.x,y:o.y+t.y,z:o.z});break;case 4:case 5:BR(e,{x:.75*a,y:t.y,z:.75*a},{x:o.x,y:o.y+t.y*(i+1),z:o.z});for(let r=0;r<4;r++)BR(e,{x:a*(r<2?.15:.4),y:t.y,z:a*(r<2?.4:.15)},{x:o.x+a*(r<2?.4:0)*(r%2==0?1:-1),y:o.y+t.y,z:o.z+a*(r<2?0:.4)*(r%2==0?1:-1)})}if(s>=3)if(a<t.x){let r=.5*(t.x-a),n=t.x/2-r/2,i={x:r,y:t.y,z:t.z};BR(e,i,{x:o.x+n,y:o.y+t.y,z:o.z}),BR(e,i,{x:o.x-n,y:o.y+t.y,z:o.z})}else if(a<t.z){let r=.5*(t.z-a),n=t.z/2-r/2,i={x:t.x,y:t.y,z:r};BR(e,i,{x:o.x,y:o.y+t.y,z:o.z+n}),BR(e,i,{x:o.x,y:o.y+t.y,z:o.z-n})}}}