memoscan
← all memos

Memo 0x231d97e6…90b06b on Ethereum

se(st*vec2(1, 3)*5.), noise(st*vec2(1, 5)*10.), 0.25);float clouds = steps(fract(cloudsSdf*2.), 10.);oCol = (insideBox && !insideFill && outsidePetals && outsideCircles) ? mix(mix(bgCol, midCol, clamp(origSt.y, 0.,1.)), bgCol, 1.-clamp((1.-origSt.y)*2.+clouds,0.,1.)): oCol;oCol = (outsidePetals && insideFill && outsideCircles) ? mix(fgCol, vec3(1), 0.25): oCol;oCol = !outsideCircles ? midCol : oCol;outline += thick*(1.-clamp(blended, 0.0, 1.));outline = clamp(smoothstep(0., thick*2., outline), 0., 1.);float outsideOutline = sdfToOutline(outsideFill, thick);float bOutline = sdfToOutline(box - boxOutlineThick, boxOutlineThick);vec3 outlineCol = darkestCol;vec3 innerOutlineCol = mix(outlineCol, vec3(0), 0.4);vec3 outerOutlineCol = mix(outlineCol, vec3(0), 0.55);vec3 lightOutlineCol = mix(outerOutlineCol, fgCol, 0.35);oCol = outsideCircles ? mix(innerOutlineCol, oCol, outline) : oCol;oCol = box_ - boxRound - boxOutlineThick*4. < 0. && !insideFill && !insidePetals ? mix(lightOutlineCol, oCol, bOutline) : oCol;oCol = outsideCircles && outsidePetals ? mix(outerOutlineCol, oCol, outsideOutline) : oCol;oCol = mix(outerOutlineCol, oCol, circlesOutline);outColor = vec4(vec3(oCol), 1.); `,this.glUniformInit,"ft",void 0,!0,!0)}getFlippedBranch(e){const[t,r]=[e.control,this.branches[e.parentId].dst].map((e=>y.vecToP5Vec(e))),o=function(e,t,r){const o=p5.Vector.sub(y.vecToP5Vec(r),t),i=p5.Vector.dot(e,o),a=o.copy().mult(Math.sign(i)*i/p5.Vector.dot(o,o)).add(t),n=p5.Vector.sub(a,e),s=p5.Vector.normalize(o),l=p5.Vector.sub(n,s.copy().mult(2*p5.Vector.dot(s,n)));return p5.Vector.add(l,a)}(t,r,e.dst);return{...e,control:{x:o.x,y:o.y}}}getScreenParams(){if(this.screenParams)return this.screenParams;let e=1/0,t=1/0,r=-1/0,o=-1/0,a=[];for(let e of this.branches){if(e.level.fill===i.Full){const t=this.getFlippedBranch(e);a.push(t)}}let n=0;for(let i of[...this.branches,...a]){const a=this.getSrc(i),s=.03*i.level.stroke,l=f(a.x,a.y,i.control.x,i.control.y,i.dst.x,i.dst.y);e=Math.min(e,l.x.min-s),t=Math.min(t,l.y.min-s),r=Math.max(r,l.x.max+s),o=Math.max(o,l.y.max+s),n++}let s=r-e,l=o-t;s=r-e,l=o-t;let c=Math.max(s,l)/2*(1+this.outerMargin),d=-(e+s/2),h=-(t+l/2);n=0;for(let i of[...this.branches,...a]){const a=this.getControlSizeGL(i);a&&(e=Math.min(e,n<this.branches.length?i.control.x-a*c:1/0),t=Math.min(t,n<this.branches.length?i.control.y-a*c:1/0),r=Math.max(r,n<this.branches.length?i.control.x+a*c:-1/0),o=Math.max(o,n<this.branches.length?i.control.y+a*c:-1/0),n++)}const m=this.margin*Math.max(s,l);e-=m,t-=m,r+=m,o+=m,s=r-e,l=o-t,c=Math.max(s,l)/2*(1+this.outerMargin),d=-(e+s/2),h=-(t+l/2);const p={minX:e,minY:t,maxX:r,maxY:o,sizeX:s,sizeY:l,middleX:d,middleY:h,scale:c,margin:m};return this.screenParams=p,p}getControlSize(e){return.03*Math.pow(e.level.length,2)}getControlSizeGL(t){return t.level.type!==s.Stem?e.map(this.getControlSize(t),this.getMinControlSize(),this.getMaxControlSize(),.005,.04):0}}const g=e=>"#"+e,v=e=>e.map(g),x=(e,...t)=>(e.splice(t[0],0,...t.slice(1)),e);let b;let y;const F=()=>{let[t,r]=(()=>{const t={rare:["poppy","lemon"],low:[e.random(["mulberry","lissitzky"]),"orange","hokusai","anna","strawberry","spring"],mid:["mango","dew","river","cucumber","mucha","woods"],hi:["blueberry","raspberry","sunset","mondrian","dragonFruit","demuth"]},r=e.random(t[y.weightedRandom(["rare","low","mid","hi"],[.04,.27,.31,.38])]);return[r,o.getPaletteOrdered(o.addHashTags(b[r]))]})();y.CONFIG.addProp("paletteName",{val:t,name:"Palette"}),y.CONFIG.addPrivProp("palette",r)},C=t=>{const r=t?t.length*e.random(T(.8,.9,.05)):1;return{branchFactor:y.CONFIG.getProp("constantTree")?y.CONFIG.getProp("constantTreeBf"):Math.round(e.random(2,4)),angle:y.CONFIG.getProp("constantTree")?y.CONFIG.getProp("constantTreeAngle"):Math.PI*e.random(T(.85,1.5,.1)),length:r,stroke:Math.max(1,t?.85*t.stroke:2.25),curvature:y.weightedRandom([e.random(.2,.4),e.random(.5,.8)],[.2,.8]),fill:y.CONFIG.getProp("constantTree")&&2===y.CONFIG.getProp("constantTreeBf")?y.weightedRandom([i.None,i.Full,i.Half],[.5,.25,.25]):i.None,type:s.None}},w=(t=1)=>{let r;return[...new Array(t)].map(((t,o)=>t=>(r=((t,r=!1)=>{const o=e.random([i.Half,i.Full]),a=e.random([2,4]),n=e.random(T(a/2*.25,1.25,.1)),l=Number(2==a&&n<=.5?e.random()<.5:r);return{...C(t),branchFactor:a,angle:Math.PI*n,angleOff:Math.PI*l,fill:o,pop:1,curvature:e.random([.5,.75])*(l<=0?1:-1),length:t?t.length*y.CONFIG.getProp("petalLength"):1,type:s.Petals}})(t),{...r,pop:1})))},P=(t,r=(y.CONFIG.getProp("constantTree")?0:y.weightedRandom([1,2],[.6,.4])),o=!0,i=0)=>[...[...new Array(e.random([1,2]))].map((()=>e=>({...C(e),...t}))),...[...new Array(r?Math.round(e.constrain(Math.abs(e.randomGaussian(i,.75*r)),i,r)):0)].map((()=>e=>(e=>({...C(e),branchFactor:1,angle:0,type:s.Spacer}))(e))),...o?w():[]],T=(e,t,r=.2)=>a.range(e,t,r);let S;const I=t=>{y=t;const r=y.weightedRandom(["growing","developed"],[.2,.8]);y.CONFIG.addProp("treeStage",{val:r,name:"Age"});const o=e.random()<.05;y.CONFIG.addProp("diamond",o);const a=o?"fit":y.weightedRandom(["thin","fit","max"],[.5,.4,.1]);y.CONFIG.addProp("windowMargin",a);const n=y.weightedRandom([0,.5],[.7,.3]);y.CONFIG.addPrivProp("windowBars",n),n&&y.CONFIG.addProp("windowBarsPerspective",y.weightedRandom(["center",e.random(["in","out"])],[.5,.5]));const l=e.random()<.05&&"developed"===r;y.CONFIG.addProp("constantTree",l),l&&y.CONFIG.addProp("constantTreeBf",{val:y.weightedRandom([2,3,4],[.6,.1,.3]),name:"Constant Tree Branching Factor"}),y.CONFIG.addPrivProp("constantTreeAngle",l?Math.PI*(y.CONFIG.getProp("constantTreeBf")>=4?1.5:y.CONFIG.getProp("constantTreeBf")>=3?1.25:(y.CONFIG.getProp("constantTreeBf"),.5)):0);const c=e.random(T(.75,.95,.01));let d;if(y.CONFIG.addPrivProp("petalLength",c),"max"!==a&&y.CONFIG.addProp("bgPattern",{name:"Origin",val:y.weightedRandom([e.random(["prairie","mountain","river","urban"]),e.random(["forest","marsh","beach","urbanOvergrown"])],[.7,.3])}),b={dragonFruit:{colors:["E9B0AF","FCDA5F","b63d34","8e1529","698996"],order:e.random([[0,3,1,...e.shuffle([4,2])],[4,3,1,...e.shuffle([0,2])]])},cucumber:{order:x(e.shuffle([0,2,3]),1,1),colors:["A5CEA1","741A29","fffacc","D9969C"]},orange:{order:y.weightedRandom([x(e.shuffle([3,2]),1,4,1,0),(()=>{const t=e.shuffle([3,2]);return x(x(x([...e.shuffle([4,0]),1],0,t[0]),2,t[1]),4,t[2])})()],[.3,.6]),colors:["EE6930","FFA647","f3e9e7","9BC2E0","1697B1"]},demuth:{order:e.random([[1,2,0,3],[0,2,1,3],[3,0,1,2]]),colors:["e3a953","fff1ab","bc3234","437988"]},sunset:{order:x(x(e.shuffle([4,3,2]),e.random([1,2,3]),1),1,0),colors:["264653","2a9d8f","e9c46a","f4a261","e76f51"]},river:{order:e.random([(()=>{const t=[...e.shuffle([2,3]),...e.shuffle([0,1])];return[t[0],t[2],t[1],t[3]]})()]),colors:["005f73","0BAAAD","A9DBCA","e9d8a6"]},mucha:{order:(()=>{const t=e.shuffle([3,4]);return x(x(e.shuffle([0,1,2]),1,t[0]),3,t[1])})(),colors:["8CB46A","f4e285","f4a259","588978","bc4b51"]},mulberry:{order:e.random([[1,2,0,3],[1,3,0,2]]),colors:["F3EEE2","cac3b3","747167","1d1e1b"]},mango:{order:(()=>{const t=e.shuffle([4,3]);return x(x(x(e.shuffle([0,1,2]),2,3),1,t[0]),4,t[1])})(),colors:["f2f3ae","edd382","fc9e4f","FF531F","020122"]},dew:{order:x(e.shuffle([1,2]),1,0,3),colors:["313715","7BB2D9","9AB752","F0FBDA"]},raspberry:{order:x(e.shuffle([1,2,3]),1,0),colors:["301a4b","72A9C2","ffeaec","f39a9d"]},blueberry:{order:x(x(e.shuffle([0,3]),1,1),e.random([2,3]),2),colors:["e9d8a6","0d1b1e","7798ab","EDC0D1"]},spring:{order:(()=>{const t=e.shuffle([1,3]);return x(x(e.shuffle([0,3]),t[0],2),t[1],1)})(),colors:["FFD3AD","69a2b0","659157","ADC893"]},mondrian:{order:e.random([[3,4,...e.shuffle([1,0]),2],x(x(e.shuffle([0,1,3]),2,4),1,2)]),colors:["e5dcc8","ebaf23","cc3b38","3372a8","1c1d1b"]},woods:{colors:["606c38","283618","E2B178","bc6c25","efb82c"],order:e.random([[0,1,4,2,3],[2,1,4,0,3]])},lissitzky:{order:e.random([[1,4,0,3,2],[1,3,0,4,2]]),colors:["F1EEE2","F3EDE2","747167","1d1e1b","980606"]},poppy:{order:[1,2,3,0],colors:["a10045","eeeeee","ffffff","ffffff"]},hokusai:{order:(()=>{const t=e.shuffle([2,3]);return[1,t[0],0,t[1]]})(),colors:["FFD9C2","d99e73","633818","3E5D78"]},anna:{order:(()=>{const t=[4,3];return x(x([2,...e.shuffle([0,1])],2,t[0]),e.random([3,4]),t[1])})(),colors:["8C94C7","DF5D5D","d77c90","f18d90","F6CCB7"]},strawberry:{order:[1,...x(e.shuffle([0,3]),1,2)],colors:["DD4831","5b5f97","E2F1AF","66101F"]},lemon:{order:[1,3,2,0],colors:["629E64","e5b329","f4e7a4","dca119"]}},F(),!l){d=y.weightedRandom([2,3,4,5,6],[.4,.3,.15,.1,.05]);const e={val:d,name:"Main Branching Factor"};"developed"===r?y.CONFIG.addProp("flairBf",e):y.CONFIG.addPrivProp("flairBf",e)}const h=new p,m=e.random(T(1,2,.1));y.CONFIG.addPrivProp("stemFact",m);const u=y.weightedRandom([1,2],[.6,.4]);y.CONFIG.addProp("numStems",{val:u+1,name:"Stem Curves"});const f=y.weightedRandom([[e.random([.15,0,3.85]),"up"],[e.random(T(.25,1.5,.25)),"left"],[e.random(T(2.5,3.75,.25)),"right"],[e.random([1.75,1.85,2.15,2.25]),"down"]],[.2,.35,.35,.1]),g=f[0];y.CONFIG.addProp("facingDir",{name:"Facing Direction",val:f[1]});let v=0;h.addLevels([...[...new Array(u)].map(((t,r,o)=>t=>{const a=C(t),n=.35,l=Math.min(Math.abs(2-g),n);let c=g>=2?e.random(T(-l,n,.1)):e.random(T(-.35,+l,.1)),d=((e,t=4)=>((e%=t)<0&&(e=t- -e),e))(g+(r<u-1?c:0)-v);return v+=d,0===r&&(y.CONFIG.addPrivProp("stemCurveP",(0===g?e.random([1,-1]):d<=2&&g<=2?1:-1)*y.weightedRandom([.2,.5,1,1.5,2],[.1,.2,.3,.3,.1])),y.CONFIG.addProp("stemCurvature",Math.abs(y.CONFIG.getProp("stemCurveP")))),{...a,branchFactor:1,angle:Math.PI*d,fill:i.None,length:a.length*m,type:r===o.length-1?s.MainStem:s.Stem}})),...e.random()<.5?w(e.random([1,2])).map((e=>t=>({...e(t),length:.5*t.length}))):[],...d?[...P({branchFactor:d,angle:Math.PI*e.random(T(e.map(Math.pow((d-2)/4,2),0,1,.5,1),1.5,.1)),fill:e.random()<.5?e.random([i.Half,i.Full]):i.None,type:s.Flair},1,0===R,1),...P({fill:e.random()<.5?e.random([i.Half,i.Full]):i.None},1,void 0,1)].flat():[]]),y.CONFIG.addPrivProp("ftConfig",{name:"config",val:h})},O=Math.min(window.innerWidth,window.innerHeight)>1800?2400:1800,N=O/1800*.75;e.setup=()=>{y=new l([e],"PROD",void 0,"Seedlings",I,N,O/N);const t=y.CONFIG.getProp("ftConfig");let o=t.getNumBranches();const i=y.weightedRandom([600,800],[.