speice.io/assets/js/5672736d.bb4bb660.js

1 line
135 KiB
JavaScript
Raw Normal View History

"use strict";(self.webpackChunkspeice_io=self.webpackChunkspeice_io||[]).push([["3589"],{58722:function(s,e,a){a.r(e),a.d(e,{metadata:()=>n,contentTitle:()=>C,default:()=>L,assets:()=>B,toc:()=>F,frontMatter:()=>A});var n=a("86131"),l=a("85893"),i=a("50065"),t=a("67"),m=a("87320"),r=a("67294"),c=a("1905"),h=a("42974"),d=a("37955"),x=a("5886");function*p(s){let{width:e,height:a,transforms:n,final:l}=s,i=new ImageData(e,a),[t,m]=[(0,h.J)(),(0,h.J)()],r=e*a*.5;for(let s=0;s<r;s++){let[e,a]=(0,d.m)(n);[t,m]=a(t,m);let[r,c]=l(t,m);s>20&&!function(s,e,a){let[n,l]=(0,x.n)(s,e,a.width);if(n<0||n>=a.width||l<0||l>=a.height)return;let i=(0,x.j)(n,l,a.width,4);a.data[i]=0,a.data[i+1]=0,a.data[i+2]=0,a.data[i+3]=255}(r,c,i),s%1e3==0&&(yield i)}yield i}var j=a("57037");let o=s=>{let{title:e,variations:a,setVariations:n,resetVariations:i}=s,t=(0,l.jsx)("button",{className:j.Z.inputReset,onClick:i,children:"Reset"});return(0,l.jsxs)("div",{className:j.Z.inputGroup,style:{display:"grid",gridTemplateColumns:"1fr 1fr"},children:[(0,l.jsxs)("p",{className:j.Z.inputTitle,style:{gridColumn:"1/-1"},children:[e," ",t]}),(0,l.jsxs)("div",{className:j.Z.inputElement,children:[(0,l.jsxs)("span",{children:["Linear: ",a.linear]}),(0,l.jsx)("input",{type:"range",min:0,max:1,step:.01,style:{width:"100%"},value:a.linear,onInput:s=>n({...a,linear:Number(s.currentTarget.value)})})]}),(0,l.jsxs)("div",{className:j.Z.inputElement,children:[(0,l.jsxs)("span",{children:["Julia: ",a.julia]}),(0,l.jsx)("input",{type:"range",min:0,max:1,step:.01,style:{width:"100%"},value:a.julia,onInput:s=>n({...a,julia:Number(s.currentTarget.value)})})]}),(0,l.jsxs)("div",{className:j.Z.inputElement,children:[(0,l.jsxs)("span",{children:["Popcorn: ",a.popcorn]}),(0,l.jsx)("input",{type:"range",min:0,max:1,step:.01,style:{width:"100%"},value:a.popcorn,onInput:s=>n({...a,popcorn:Number(s.currentTarget.value)})})]}),(0,l.jsxs)("div",{className:j.Z.inputElement,children:[(0,l.jsxs)("span",{children:["PDJ: ",a.pdj]}),(0,l.jsx)("input",{type:"range",min:0,max:1,step:.01,style:{width:"100%"},value:a.pdj,onInput:s=>n({...a,pdj:Number(s.currentTarget.value)})})]})]})};var N=a("58611"),g=a("27729"),y=a("64814"),u=a("62025"),v=a("56089");function f(s,e){return[[e.linear,g.G],[e.julia,y.e],[e.popcorn,(0,u.X)(s)],[e.pdj,(0,v.i)(c.fm)]]}function b(){let{width:s,height:e,setPainter:a}=(0,r.useContext)(m.wn),n={linear:0,julia:1,popcorn:0,pdj:0},[i,t]=(0,r.useState)(n),h={linear:1,julia:0,popcorn:1,pdj:0},[d,x]=(0,r.useState)(h),j={linear:0,julia:0,popcorn:0,pdj:1},[g,y]=(0,r.useState)(j),u=(s,e)=>[s,e];return(0,r.useEffect)(()=>{let n=[[c.aI,(0,N.N)(c.xN,f(c.xN,i))],[c.DO,(0,N.N)(c.v$,f(c.v$,d))],[c.qR,(0,N.N)(c.d3,f(c.d3,g))]];a(p({width:s,height:e,transforms:n,final:u}))},[i,d,g]),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o,{title:"Transform 1",variations:i,setVariations:t,resetVariations:()=>t(n)}),(0,l.jsx)(o,{title:"Transform 2",variations:d,setVariations:x,resetVariations:()=>x(h)}),(0,l.jsx)(o,{title:"Transform 3",variations:g,setVariations:y,resetVariations:()=>y(j)})]})}var w=a("22237");let R=s=>{let{title:e,isPost:a,coefs:n,setCoefs:i,resetCoefs:t}=s,m=(0,l.jsx)("button",{className:j.Z.inputReset,onClick:t,children:"Reset"});return(0,l.jsxs)("div",{className:j.Z.inputGroup,style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr"},children:[(0,l.jsxs)("p",{className:j.Z.inputTitle,style:{gridColumn:"1/-1"},children:[e," ",m]}),(0,l.jsxs)("div",{className:j.Z.inputElement,children:[(0,l.jsxs)("p",{children:[a?(0,l.jsx)(w.Z,{children:"\\alpha"}):"a",": ",n.a]}),(0,l.jsx)("input",{type:"range",min:-2,max:2,step:.01,value:n.a,onInput:s=>i({...n,a:Number(s.currentTarget.value)})})]}),(0,l.jsxs)("div",{className:j.Z.inputElement,children:[(0,l.jsxs)("p",{children:[a?(0,l.jsx)(w.Z,{children:"\\beta"}):"b",": ",n.b]}),(0,l.jsx)("input",{type:"range",min:-2,max:2,step:.01,value:n.b,onInput:s=>i({...n,b:Number(s.currentTarget.value)})})]}),(0,l.jsxs)("div",{className:j.Z.inputElement,children:[(0,l.jsxs)("p",{children:[a?(0,l.jsx)(w.Z,{children:"\\gamma"}):"c",": ",n.c]}),(0,l.jsx)("input",