0x18b75119…b783sent to0x381233d5…7acd·#19,594,904·view on Etherscan
[1,()=>{console.log("Artist 8. Julian Hespenheide -- platform 1");const PROJECTNAME="Excerpt";let abColor,abColorPlus,abColor2;const c64c=["#000000","#ffffff","#813338","#75cec8","#8e3c97","#56ac4d","#2e2c9b","#edf171","#8e5029","#553800","#c46c71","#4a4a4a","#7b7b7b","#a9ff9f","#706deb","#b2b2b2"],shades=[11,12,15];let highColors=[2,3,4,5,6,7,8,9,10,13,14],fontData=["8080808080808080","80808080302180808030","302150413021202120212021206120212021202120218010","105130212021202120212051302120212021202120518020","2041302120212021602160216021202130418020","1051302120212021202120212021202120212021202120518020","10612021602160414021602160618010","10612021602160414021602160218050","204130212021202160211031202120212021202130418020","10212021202120212021202120612021202120212021202120218010","20415021602160216021602150418020","403160216021602160212021202130418020","10212021202120212021102130414021102130212021202120218010","10216021602160216021602160618010","2130211031103110711021101110211021302110213021102130218010","10212021203110212061202110312021202120212021202120218010","2041302120212021202120212021202120212021202130418020","1051302120212021202120513021602160218050","204130212021202120212021202120212021202110313041702110","1051302120212021202120513021202120212021202120218010","2041302120212021704170212021202130418020","10614021602160216021602160218030","10212021202120212021202120212021202120212021202130418020","1021202120212021202120212021202120212021304150218030","21302110213021102130211021101110211021101110211071202110218020","102120212021202130415021504130212021202120218010","10212021202120212021202130415021602160218030","10616021502150215021502160618010","2041302120212021103120311021202120212021202130418020","30215031602160216021602160218030","2041302120216021304130216021202120618010","2041302120216021403170212021202130418020","3031404130211021202120212071502160218020","1061202120212021605170212021202130418020","20413021202120216051302120212021202130418020","106120212021602150215021602160218030","204130212021202120213041302120212021202130418020","20413021202120212021305160212021202130418020","808080808030216021502140","8080803021806021808030","80808030218060216021502140","8080803021602180808030","801021202130412081204130212021808010","302160216021602160218060218030","2041302120216021502150218060218030","1021102130211021207120211021207120211021302110218020","60116021502150215021502160118060","8080402150215021702170218020","808020211021202110212021102140211021402110218010","3021502150215021602170217021702130","20414021602160216021602160418020","40215021502160216021702170218020","40215021602150217021602170218020","20217021602170215021602150218040","20217021702160216021502150218040","20416021602160216021602140418020","3021702170217021602150215021502130","8080211021402110214021102120211021202110218030","8080202170217021502150218040","401170216011101150115031404150218040","20513011301130113011301130112021202110311031201130118020","8080201110114051401110114051401110118030","30116031405120711071401160318030","20315031307110711071401160318030","102110212071107110712051403160118040","30116031405120712051403160118040","2031402110214031403110211021103120212021303110218010","8080302160214061402160218030","80808080204180808020","808010212021304150215041302120218010","808030218040618040218030","8080801051803051808020","808020311011202110318030311011202110318010","808080802031101120211031808010","8010212021202110215021502150212021201130218010","301160314011101110112011201120114011701170118040","802051602150111011401120113011301120118060","30118011801120716011601160118040","801011801130114011201150111011602130518010","301170117011401120112011201110111011403160118040","806011201130113011201140111011502160518020","30116011601160712011801180118040","801051302160111011501120114011301180118010","8080808080808081","8080808080808181","8080808080818181","8080808081818181","8181818181818181","8181818180808080","8180808080808080","11701170117011701170117011701170","21602160216021602160216021602160","31503150315031503150315031503150","41404140414041404140414041404140","40414041404140414041404140414041","70117011701170117011701170117011","808080804140414041404140","808080804041404140414041","414041404140418080808040","414041404140414081818181","414041404140418041404140414041","818181814140414041404140","818181814041404140414041","404140414041404180808080","404140414041408140414041404140","404140414041408181818141","2041306110818181811061304120","2041302120211021403160216031402110212021304120","3011101130118050218060218050113011101130","811071206130514041503160217011","701160215031404130512061108171","117021603150414051306120711081","817110612051304140315021601170","21405120311061304140413061103120514021","216031603160316031603160316021","6021503140314031403140314031502160","8080803021602160216021602130","808080818130216021602130","80808051305160216021602130","8080803051305130216021602130","8080808181808080","80808051305180808030","80808030513051808080","3021602160216021602180808030","302160216021308181808080","3021602160213051305180808030","30216021602160513051808080","3021602160216021602160216021602130","30216021602130818130216021602130","3021602160213051305160216021602130","3021602160216051305130216021602130","801011401130112011808040112011301140118010","808020112011808040112011808020","8080803021602180808030","808050118050118050118060","8080101180801011808010118020","1011101110111011801110111011101180201110111011101180111011101110118010","101110111011102110111011101120111011101110211011101110112011101110111021101110111011201110111011102110111011101110","811110111011101110811110111011101110811110111011101110811110111011101110"],spacers=[0,1,83,89,68,41],cPool=["2-27","28-37","38-46","47-58","59-65","66-74","75-82","83-95","96-105","106-108","109-112","113-115","116-130","131-133","134-135","136-138"],mods=[],mo=["v","i","r","f"],theCharset=[],sprite,mC,source,out,interpreter,gX=16,gY=16,theMaxGrid=82,shortEdge,longEdge,dtype,brdr=0,fontSize=8,theScale=1,values=[],targets=[],states=[],charSetLen=0,play=!0,debug=!1,resizing=!1,ts=0,intv=20,timestamps,intervals,currents,strokes,goals,steps,centers,extensions,grids,gridUpdates,cycles,bgFade=0,ranges,rotations,roundness,timeouts,refresh,exportCounter=0,theParams;function getExportName(){var e=year()+""+nf(month(),2)+nf(day(),2)+"-",e=(exportCounter++,e+PROJECTNAME+"-"+nf(exportCounter,3));return e}p5.disableFriendlyErrors=!0,sPrms=function(){void 0!==(theParams=getURLParams()).grid&&(theMaxGrid=int(theParams.grid)<5?4:int(theParams.grid)),void 0!==theParams.border&&(brdr=int(theParams.border))},preload=()=>{sPrms(),detectDevice(),gridCalc(),interpreter=new Interpreter(gX,gY,fontSize,theScale),abVars()},setup=()=>{(mC=createCanvas((gX+brdr)*fontSize*theScale,(gY+brdr)*fontSize*theScale,WEBGL)).class("canvas"),mC.position(0,0),frameRate(120),noStroke(),pixelDensity(1),imageMode(CENTER),rectMode(CENTER);const e=document.getElementById("defaultCanvas0"),t=e.getContext("webgl");t.imageSmoothingEnabled=!1,crisp(),createSprite(theCharset),createSource(),createOut(),initArrays(),welcome()},welcome=function(){console.log("%c· · · · · · "+PROJECTNAME+" · · · · · · ","color: #7F7F7F;"),console.log("\tA contribution by Julian Hespenheide (2024) for\n\tBright Moments: The Finale 🎭\n\nThe underlying grid of the animation is responsive.\n· [f] Fullscreen\n· [spacebar] Play/pause\n· [s] Export PNG\n"),console.log("· [Grid] "+gX+"×"+gY+"\n"+abColor+" / "+abColorPlus),console.log()},draw=()=>{play&&(background(bg),animation(),resizing||calcAndStuff(),interpreter.apply(out,charSetLen,sprite),push(),image(interpreter.display(),0,0,interpreter.display().width,interpreter.display().height),pop(),dV(),resizing=!1)},dV=function(){debug&&(push(),fill(0),rect(0,0,sprite.width+16,sprite.height+16),rect(0,0,2*source.width+16,source.height+16),image(sprite,0,0,sprite.width,-sprite.height),pop())},initArrays=function(){for(let e=0;e<gX*gY;e++)values[e]=0,targets[e]=0,states[e]=1},setTarget=function(e,t){1===states[e]&&(targets[e]=constrain(t,0,255),states[e]=0)},windowResized=function(){resizing=!0,/\bHeadlessChrome/.test(navigator.userAgent)||(gridCalc(),resizeCanvas((gX+brdr)*fontSize*theScale,(gY+brdr)*fontSize*theScale),crisp(),interpreter.resized(constrain(gX,2,theMaxGrid),constrain(gY,2,theMaxGrid),fontSize,theScale),initArrays(),resizeSource(),resizeOut(),console.log("windowSize= "+innerWidth+"x"+innerHeight+"pxl "+gX+"/"+gY))},createSource=function(){(source=createGraphics(gX,gY)).class("🖼️"),source.background(0),source.rectMode(CENTER),source.imageMode(CENTER),source.angleMode(DEGREES),source.noFill(),source.stroke(255)},resizeSource=function(){source.width=gX,source.height=gY,source.pixelDensity(1)},createOut=function(){(out=createGraphics(gX,gY)).class("out 🟡"),out.background(0)},resizeOut=function(){out.width=gX,out.height=gY,out.pixelDensity(1)},createSprite=function(t="0-10"){var s,o;let r="";for(let e=0;e<t.length;e++)0===e?r=t[e]+"":1===e?r+=spacers[t[e]]+"":r+=cPool[t[e]]+"",e+1<t.length&&(r+=";");var n,a=split(r,";");for(let e=0;e<a.length;e++){var i=split(a[e],"-");charSetLen+=1===i.length?1:i[1]-i[0]+1}(sprite=createGraphics(8*charSetLen,8)).pixelDensity(1);let g=createGraphics(8,8),c=(g.pixelDensity(1),[]);n=bg=c64c[0],(c=shades).push(abColor);var e=abColor;abColorPlus&&c.push(abColor2);let d=0;for(let i=0;i<a.length;i++){var l=split(a[i],"-");if(bg="i"===mods[i]||"f"===mods[i]?c64c[e]:n,1===l.length)fg="i"===mods[i]?n:c64c[c[[int(map(d,0,charSetLen,0,c.length))]]],genChar(dcrle(fontData[l[0]],64),g,bg,fg),sprite.image(g,8*d,0),d++;else{s=l[0],o=l[1];let t=[],r=0;for(let e=int(s);e<=int(o);e++)t[r++]=int(e);"r"!==mods[i]&&"f"!==mods[i]||reverse(t);for(let e=0;e<t.length;e++)fg="i"===mods[i]||"f"===mods[i]?n:c64c[c[[int(map(d,0,charSetLen,0,c.length))]]],genChar(dcrle(fontData[t[e]],64),g,bg,fg),sprite.image(g,8*d,0),d++}}let u=createGraphics(sprite.width,sprite.height);u.pixelDensity(1),u.translate(0,0),u.scale(1,-1),u.image(sprite,0,-sprite.height),sprite.image(u,0,0),u.remove(),g.remove(),bg=n},abVars=function(){abColor=R.random_choice(highColors),abColor2=R.random_choice(highColors),abColorPlus=R.random_bool(.5),theCharset=[0,R.random_int(0,spacers.length-1)],mods[0]="v",mods[1]=mods[0];for(let e=0;e<8;e++)theCharset[e+2]=R.random_int(0,cPool.length-1),mods[e+2]=!(e<5)||R.random_bool(.25)?mo[R.random_int(0,3)]:0;intv=R.random_int(20,40),timestamps=[0,0],intervals=[R.random_int(120,200),R.random_int(200,700)],goals=[R.random_int(0,longEdge-1),0],currents=[R.random_int(0,goals[0]),0],strokes=[R.random_int(0,255),0],steps=[R.random_int(1,10),0],centers=[R.random_int(0,longEdge/12),0],extensions=[R.random_int(1,4),0],grids=[[R.random_int(1,longEdge/16),R.random_int(1,longEdge/16)],[0,0]],gridUpdates=[2,2],cycles=[0,0],ranges=[R.random_int(0,longEdge),0],rotations=[R.random_choice([0,-45,45]),0],roundness=[R.random_int(0,10),0],timeouts=[[-1e3,0],[-1e3,0],0],refresh=[R.random_bool(.25),0]},updater=function(e){var t;millis()-timeouts[e][0]>timeouts[e][1]&&(t=map(currents[e],0,goals[e],0,1),t=smoothStep(0,1,t),map(t,0,1,0,goals[e])<goals[e]?millis()-timestamps[e]>intervals[e]&&(timestamps[e]=millis(),currents[e]+=steps[e],0===e&&(bgFade+=refresh[e]?.5:-.5,bgFade=constrain(bgFade,0,255))):(goals[e]=R.random_int(longEdge,longEdge*extensions[e]-1),currents[e]=0,steps[e]=R.random_int(1,longEdge/12),cycles[e]+=1,cycles[e]%gridUpdates[e]&&(centers[e]=R.random_int(0,longEdge/12),extensions[e]=R.random_int(1,4),grids[e]=[R.random_int(1,longEdge/16),R.random_int(1,longEdge/16)],gridUpdates[e]=R.random_int(7,20),ranges[e]=R.random_int(0,longEdge),rotations[e]=R.random_choice([0,-45,45]),roundness[e]=R.random_int(0,10),strokes[e]=R.random_int(0,255),timeouts[e][0]=millis(),timeouts[e][1]=R.random_int(7e3,15e3),0===e&&(refresh[e]=R.random_bool(.25)))))},animation=function(){source.push(),source.noStroke(),source.fill(0,bgFade),source.rect(source.width/2,source.height/2,gX,gY),source.pop(),source.push(),source.translate(source.width/2,source.height/2);updater(0),griddy(source,0),updater(1),griddy(source,1),source.pop()},griddy=function(r,i){r.push(),r.rotate(0===i?rotations[i]:0),r.stroke(0===i?strokes[i]:0),w=grids[i][0],h=grids[i][1],r.translate(ranges[i]/2,ranges[i]/2);for(let t=-h/2;t<h/2;t++)for(let e=-w/2;e<w/2;e++)r.rect(e*ranges[i],t*ranges[i],currents[i]+centers[i],currents[i]+centers[i],roundness[i]);r.pop()},calcAndStuff=function(){if(millis()-ts>intv){ts=millis(),out.loadPixels(),source.loadPixels();for(let t=0;t<gY;t++)for(let e=0;e<gX;e++){var r=t*gX+e,i=4*+r;setTarget(r,source.pixels[i]),0===states[r]&&(values[r]!==targets[r]?(values[r]+=1,values[r]%=256):values[r]===targets[r]&&(states[r]=1)),out.pixels[0+i]=red(values[r]),out.pixels[1+i]=0,out.pixels[2+i]=0,out.pixels[3+i]=255}out.updatePixels()}},crisp=function(){canvas.style.width=innerWidth+"px",canvas.style.height=innerHeight+"px",canvas.style.imageRendering="pixelated"},genChar=function(t,r,i,s){for(let e=0;e<t.length;e++){var o=int(e%8),n=int(e/8),a=0===t[e]?i:s;r.stroke(a),r.point(o,n)}},dcrle=function(e,t){let r=[],i=0;for(;i<e.length;){var s=parseInt(e[i]),o=e[i+1];for(let e=0;e<s;e++)r.push(parseInt(o));i+=2}return r.length=t,r},gridCalc=function(){getWindowFormat(),gX%2!=0&&--gX,gY%2!=0&&--gY},detectDevice=function(){"ontouchstart"in document.documentElement?(dtype="mobile",theMaxGrid=48):dtype="desktop"},gcd=function(e,t){return 0==t?e:gcd(t,e%t)},getWindowFormat=function(){var e=gcd(innerWidth,innerHeight);windowWidth==windowHeight?(gX=gY=theMaxGrid,shortEdge=longEdge=gX):longEdge=windowWidth>windowHeight?(gX=theMaxGrid,gY=int(innerHeight/e*theMaxGrid/(innerWidth/e)),shortEdge=gY,gX):(gX=int(innerWidth/e*theMaxGrid/(innerHeight/e)),gY=theMaxGrid,shortEdge=gX,gY)},keyPressed=function(){" "===key?(play=!play,console.log("["+PROJECTNAME+"] playing : "+play)):"D"===key?debug=!debug:"s"===key&&saveCanvas(mC,getExportName(),"png")},keyTyped=function(){var e;"f"===key&&(((e=fullscreen())?cursor:noCursor)(),fullscreen(!e))},smoothStep=function(e,t,r){r=Math.max(0,Math.min(1,(r-e)/(t-e)));return r*r*(3-2*r)};class Interpreter{constructor(e,t,r,i){this.gX=e,this.gY=t,this.b=createGraphics(r*this.gX*i,r*this.gY*i,WEBGL),this.b.class("interpreter 🖼️"),this.b.background(0),this.b.pixelDensity(1),this.s=this.b.createShader(iv,ifr)}resized(e,t,r,i){this.gX=e,this.gY=t,this.b.width=r*this.gX*i,this.b.height=r*this.gY*i,this.b.pixelDensity(1)}apply(e,t,r){this.s.setUniform("u_spt",r),this.s.setUniform("u_spCl",t),this.s.setUniform("u_spR",[r.width,r.height]),this.s.setUniform("u_sc",e),this.s.setUniform("u_In",[e.width,e.height]),this.s.setUniform("u_rOut",[this.b.width,this.b.height]),this.s.setUniform("u_gX",this.gX),this.s.setUniform("u_gY",this.gY),this.b.shader(this.s),this.b.rectMode(CENTER),this.b.noStroke(),this.b.rect(0,0,width,height)}display(){return this.b}}let iv=`#ifdef GL_ES
precision mediump float;
#endif
attribute vec3 aPosition;varying vec2 vTexCoord;attribute vec2 aTexCoord;void main(){vTexCoord=aTexCoord;vec4 d=vec4(aPosition,1);d.xy=d.xy*2.-1.;gl_Position=d;}`,ifr=`#ifdef GL_ES
precision mediump float;
#endif
varying vec2 vTexCoord;uniform vec2 u_In;uniform vec2 u_rOut;uniform sampler2D u_sc;uniform sampler2D u_spt;uniform vec2 u_spR;uniform int u_spCl;uniform float u_gX;uniform float u_gY;void main(){vec2 u=vTexCoord;u.y=1.-u.y;vec2 s=floor(u*u_In)/u_In;vec4 f=texture2D(u_sc,s);vec2 v=gl_FragCoord.xy/u_rOut.xy;v.x*=u_gX;v.y*=u_gY;v=fract(v);vec4 y=vec4(0);vec2 m=u_spR/vec2(float(u_spCl),1),t=floor(u_spR/m);v/=t;float n=f.x*(float(u_spCl)-1.),r=floor(n/float(u_spCl));v=fract(v+vec2(floor(n)/t.x,floor(r)/t.y));y=texture2D(u_spt,v);gl_FragColor=y;}`;
}],