116 lines
33 KiB
HTML
116 lines
33 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="stylesheet" href="../css/login.css">
|
|
<link rel="stylesheet" href="../css/global.css">
|
|
<title>Jellyfin</title>
|
|
</head>
|
|
<body>
|
|
<canvas id="background"></canvas>
|
|
<main>
|
|
<section class="page server">
|
|
<section class="server__cont">
|
|
<div class="logo">
|
|
<svg width="100%" height="100%" viewBox="0 0 1536 140" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<path d="M53.5075 139.735C44.3971 139.735 35.9283 137.682 28.1011 133.576C20.2739 129.342 13.8581 123.568 8.85381 116.254C3.84952 108.94 0.898268 100.856 6.10352e-05 92.0021H7.12156C8.01977 99.5727 10.6502 106.502 15.0129 112.789C19.3757 118.948 24.8932 123.824 31.5656 127.417C38.3663 130.882 45.6803 132.614 53.5075 132.614C62.1047 132.614 69.996 130.497 77.1817 126.262C84.3674 122.028 90.0774 116.189 94.3118 108.747C98.5462 101.305 100.663 92.9644 100.663 83.7257V10.0086H40.6118V2.88709H107.592V83.7257C107.592 94.2476 105.154 103.807 100.278 112.404C95.5308 120.873 88.9867 127.545 80.6462 132.421C72.434 137.297 63.3878 139.735 53.5075 139.735Z" fill="white"/>
|
|
<path d="M152.099 2.88709H246.41V10.0086H159.22V64.286H235.055V71.4075H159.22V129.727H246.41V136.848H152.099V2.88709Z" fill="white"/>
|
|
<path d="M299.386 136.848V2.88709H306.507V129.727H399.857V136.848H299.386Z" fill="white"/>
|
|
<path d="M441.861 136.848V2.88709H448.982V129.727H542.332V136.848H441.861Z" fill="white"/>
|
|
<path d="M578.369 2.88709L625.91 74.487L673.066 2.88709H681.535L629.374 81.9935V136.848H622.253V81.9935L569.9 2.88709H578.369Z" fill="white"/>
|
|
<path d="M730.853 136.848H723.731V2.88709H777.624C786.606 2.88709 794.882 4.81182 802.453 8.66128C810.152 12.5107 816.247 17.9641 820.738 25.0215C825.229 32.0788 827.474 40.2268 827.474 49.4655C827.474 58.3193 825.165 66.4673 820.545 73.9096C816.054 81.3519 809.895 87.0619 802.068 91.0397C795.267 94.5042 787.119 96.2365 777.624 96.2365H730.853V136.848ZM730.853 89.115H777.624C785.836 89.115 792.572 87.8318 797.833 85.2655C804.634 82.0576 810.087 77.2458 814.194 70.83C818.3 64.4143 820.353 57.2928 820.353 49.4655C820.353 41.7666 818.3 34.7093 814.194 28.2935C810.087 21.8778 804.57 17.0659 797.641 13.858C792.38 11.2917 785.708 10.0086 777.624 10.0086H730.853V89.115Z" fill="white"/>
|
|
<path d="M869.286 136.848V2.88709H876.407V129.727H969.757V136.848H869.286Z" fill="white"/>
|
|
<path d="M1116.27 136.848H990.012L1053.14 0L1116.27 136.848ZM1001.18 129.727H1105.11L1053.14 16.9376L1001.18 129.727Z" fill="url(#paint0_linear_4_2)"/>
|
|
<path d="M1148.27 2.88709L1195.81 74.487L1242.97 2.88709H1251.43L1199.27 81.9935V136.848H1192.15V81.9935L1139.8 2.88709H1148.27Z" fill="white"/>
|
|
<path d="M1291.9 2.88709H1386.21V10.0086H1299.02V64.286H1374.86V71.4075H1299.02V129.727H1386.21V136.848H1291.9V2.88709Z" fill="white"/>
|
|
<path d="M1536 136.848H1433.03C1433.03 84.5332 1433.03 55.2022 1433.03 2.88709H1485.19C1496.35 2.88709 1505.46 4.87598 1512.52 8.85375C1519.45 12.7032 1524.84 17.9641 1528.69 24.6365C1532.54 31.3089 1534.46 38.6871 1534.46 46.7709C1534.46 56.7795 1531.38 65.7616 1525.22 73.7171C1519.06 81.5444 1511.3 86.7411 1501.93 89.3074L1536 136.848ZM1445.15 10.0086L1497.51 83.1483C1506.1 81.3519 1513.22 77.0533 1518.87 70.2526C1524.52 63.4519 1527.34 55.6247 1527.34 46.7709C1527.34 39.7136 1525.61 33.2978 1522.14 27.5236C1518.68 21.7494 1513.8 17.3226 1507.51 14.243C1501.87 11.4201 1494.49 10.0086 1485.38 10.0086H1445.15ZM1440.15 14.6279V83.7257H1489.61L1440.15 14.6279ZM1440.15 129.727H1522.53L1494.43 90.6547L1488.46 90.8472H1440.15V129.727Z" fill="url(#paint1_linear_4_2)"/>
|
|
<defs>
|
|
<linearGradient id="paint0_linear_4_2" x1="1087" y1="72.9999" x2="990" y2="137" gradientUnits="userSpaceOnUse">
|
|
<stop stop-color="#00A4DC"/>
|
|
<stop offset="1" stop-color="#AA5CC3"/>
|
|
</linearGradient>
|
|
<linearGradient id="paint1_linear_4_2" x1="1536" y1="6.74843e-05" x2="1433" y2="137" gradientUnits="userSpaceOnUse">
|
|
<stop stop-color="#00A4DC"/>
|
|
<stop offset="1" stop-color="#AA5CC3"/>
|
|
</linearGradient>
|
|
</defs>
|
|
</svg>
|
|
</div>
|
|
<div class="form__cont">
|
|
<div class="input">
|
|
<input id="serverUrl" type="url" class="input__text server__url" onblur="setLabelPos(this)">
|
|
<label for="serverUrl" class="input__label">Server Address</label>
|
|
</div>
|
|
<button class="input__btn save__server clicky">
|
|
<span class="btn__label">Save</span>
|
|
</button>
|
|
<div class="info">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-square" viewBox="0 0 16 16">
|
|
<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"/>
|
|
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>
|
|
</svg>
|
|
<div>
|
|
Enter your Jellyfin server address above<br>
|
|
Example: https://jellyfin.mydomain.com or http://192.168.25.35:8096
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
<section class="page users hide">
|
|
<section class="user__cont"></section>
|
|
<button class="change__server clicky" onclick="changeServer()">
|
|
<span>Change Server</span>
|
|
</button>
|
|
</section>
|
|
<section class="page manual__login hide">
|
|
<section class="manual__input"></section>
|
|
</section>
|
|
<div class="popup__exit hide"></div>
|
|
<div class="popup error hide">
|
|
<div class="icon">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-triangle" viewBox="0 0 16 16">
|
|
<path d="M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016.146.146 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.163.163 0 0 1-.054.06.116.116 0 0 1-.066.017H1.146a.115.115 0 0 1-.066-.017.163.163 0 0 1-.054-.06.176.176 0 0 1 .002-.183L7.884 2.073a.147.147 0 0 1 .054-.057zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z"/>
|
|
<path d="M7.002 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995z"/>
|
|
</svg>
|
|
</div>
|
|
<h2 class="text">Can't determine if the entered Server address is a valid Jellyfin Server</h2>
|
|
<button class="popup__exit__btn clicky">
|
|
<span class="btn__label">Try Again</span>
|
|
</button>
|
|
</div>
|
|
<div class="loader hide">
|
|
<svg width="52" height="12" viewBox="0 0 52 12" fill="none" xmlns="http://www.w3.org/2000/svg" xml:space="preserve">
|
|
<circle cx="6" cy="6" r="6" fill="white">
|
|
<animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.1"></animate>
|
|
</circle>
|
|
<circle cx="26" cy="6" r="6" fill="white">
|
|
<animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.2"></animate>
|
|
</circle>
|
|
<circle cx="46" cy="6" r="6" fill="white">
|
|
<animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.3"></animate>
|
|
</circle>
|
|
</svg>
|
|
|
|
</div>
|
|
</main>
|
|
<script>if (typeof module === 'object') {
|
|
window.module = module;
|
|
module = undefined;
|
|
};
|
|
</script>
|
|
<script src="https://cdn.jsdelivr.net/gh/jquery/jquery@3.6.0/dist/jquery.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/jquery.scrollto@2.1.3/jquery.scrollTo.min.js"></script>
|
|
<script src="../js/login.js"></script>
|
|
|
|
<script>if (window.module) module = window.module;</script>
|
|
|
|
<script>
|
|
function normalizeColor(e){return[(e>>16&255)/255,(e>>8&255)/255,(255&e)/255]}["SCREEN","LINEAR_LIGHT"].reduce(((e,n,t)=>Object.assign(e,{[n]:t})),{});class MiniGl{constructor(e,n,t,i=!1){const s=this,o=-1!==document.location.search.toLowerCase().indexOf("debug=webgl");s.canvas=e,s.gl=s.canvas.getContext("webgl",{antialias:!0}),s.meshes=[];const r=s.gl;n&&t&&this.setSize(n,t),s.lastDebugMsg,s.debug=i&&o?function(e){const n=new Date;n-s.lastDebugMsg>1e3&&console.log("---"),console.log(n.toLocaleTimeString()+Array(Math.max(0,32-e.length)).join(" ")+e+": ",...Array.from(arguments).slice(1)),s.lastDebugMsg=n}:()=>{},Object.defineProperties(s,{Material:{enumerable:!1,value:class{constructor(e,n,t={}){const i=this;function o(e,n){const t=r.createShader(e);return r.shaderSource(t,n),r.compileShader(t),r.getShaderParameter(t,r.COMPILE_STATUS)||console.error(r.getShaderInfoLog(t)),s.debug("Material.compileShaderSource",{source:n}),t}function a(e,n){return Object.entries(e).map((([e,t])=>t.getDeclaration(e,n))).join("\n")}i.uniforms=t,i.uniformInstances=[];const l="\n precision highp float;\n ";i.vertexSource=`\n ${l}\n attribute vec4 position;\n attribute vec2 uv;\n attribute vec2 uvNorm;\n ${a(s.commonUniforms,"vertex")}\n ${a(t,"vertex")}\n ${e}\n `,i.Source=`\n ${l}\n ${a(s.commonUniforms,"fragment")}\n ${a(t,"fragment")}\n ${n}\n `,i.vertexShader=o(r.VERTEX_SHADER,i.vertexSource),i.fragmentShader=o(r.FRAGMENT_SHADER,i.Source),i.program=r.createProgram(),r.attachShader(i.program,i.vertexShader),r.attachShader(i.program,i.fragmentShader),r.linkProgram(i.program),r.getProgramParameter(i.program,r.LINK_STATUS)||console.error(r.getProgramInfoLog(i.program)),r.useProgram(i.program),i.attachUniforms(void 0,s.commonUniforms),i.attachUniforms(void 0,i.uniforms)}attachUniforms(e,n){const t=this;void 0===e?Object.entries(n).forEach((([e,n])=>{t.attachUniforms(e,n)})):"array"==n.type?n.value.forEach(((n,i)=>t.attachUniforms(`${e}[${i}]`,n))):"struct"==n.type?Object.entries(n.value).forEach((([n,i])=>t.attachUniforms(`${e}.${n}`,i))):(s.debug("Material.attachUniforms",{name:e,uniform:n}),t.uniformInstances.push({uniform:n,location:r.getUniformLocation(t.program,e)}))}}},Uniform:{enumerable:!1,value:class{constructor(e){this.type="float",Object.assign(this,e),this.typeFn={float:"1f",int:"1i",vec2:"2fv",vec3:"3fv",vec4:"4fv",mat4:"Matrix4fv"}[this.type]||"1f",this.update()}update(e){void 0!==this.value&&r[`uniform${this.typeFn}`](e,0===this.typeFn.indexOf("Matrix")?this.transpose:this.value,0===this.typeFn.indexOf("Matrix")?this.value:null)}getDeclaration(e,n,t){const i=this;if(i.excludeFrom!==n){if("array"===i.type)return i.value[0].getDeclaration(e,n,i.value.length)+`\nconst int ${e}_length = ${i.value.length};`;if("struct"===i.type){let s=e.replace("u_","");return s=s.charAt(0).toUpperCase()+s.slice(1),`uniform struct ${s} \n {\n`+Object.entries(i.value).map((([e,t])=>t.getDeclaration(e,n).replace(/^uniform/,""))).join("")+`\n} ${e}${t>0?`[${t}]`:""};`}return`uniform ${i.type} ${e}${t>0?`[${t}]`:""};`}}}},PlaneGeometry:{enumerable:!1,value:class{constructor(e,n,t,i,o){r.createBuffer(),this.attributes={position:new s.Attribute({target:r.ARRAY_BUFFER,size:3}),uv:new s.Attribute({target:r.ARRAY_BUFFER,size:2}),uvNorm:new s.Attribute({target:r.ARRAY_BUFFER,size:2}),index:new s.Attribute({target:r.ELEMENT_ARRAY_BUFFER,size:3,type:r.UNSIGNED_SHORT})},this.setTopology(t,i),this.setSize(e,n,o)}setTopology(e=1,n=1){const t=this;t.xSegCount=e,t.ySegCount=n,t.vertexCount=(t.xSegCount+1)*(t.ySegCount+1),t.quadCount=t.xSegCount*t.ySegCount*2,t.attributes.uv.values=new Float32Array(2*t.vertexCount),t.attributes.uvNorm.values=new Float32Array(2*t.vertexCount),t.attributes.index.values=new Uint16Array(3*t.quadCount);for(let e=0;e<=t.ySegCount;e++)for(let n=0;n<=t.xSegCount;n++){const i=e*(t.xSegCount+1)+n;if(t.attributes.uv.values[2*i]=n/t.xSegCount,t.attributes.uv.values[2*i+1]=1-e/t.ySegCount,t.attributes.uvNorm.values[2*i]=n/t.xSegCount*2-1,t.attributes.uvNorm.values[2*i+1]=1-e/t.ySegCount*2,n<t.xSegCount&&e<t.ySegCount){const s=e*t.xSegCount+n;t.attributes.index.values[6*s]=i,t.attributes.index.values[6*s+1]=i+1+t.xSegCount,t.attributes.index.values[6*s+2]=i+1,t.attributes.index.values[6*s+3]=i+1,t.attributes.index.values[6*s+4]=i+1+t.xSegCount,t.attributes.index.values[6*s+5]=i+2+t.xSegCount}}t.attributes.uv.update(),t.attributes.uvNorm.update(),t.attributes.index.update(),s.debug("Geometry.setTopology",{uv:t.attributes.uv,uvNorm:t.attributes.uvNorm,index:t.attributes.index})}setSize(e=1,n=1,t="xz"){const i=this;i.width=e,i.height=n,i.orientation=t,i.attributes.position.values&&i.attributes.position.values.length===3*i.vertexCount||(i.attributes.position.values=new Float32Array(3*i.vertexCount));const o=e/-2,r=n/-2,a=e/i.xSegCount,l=n/i.ySegCount;for(let e=0;e<=i.ySegCount;e++){const n=r+e*l;for(let s=0;s<=i.xSegCount;s++){const r=o+s*a,l=e*(i.xSegCount+1)+s;i.attributes.position.values[3*l+"xyz".indexOf(t[0])]=r,i.attributes.position.values[3*l+"xyz".indexOf(t[1])]=-n}}i.attributes.position.update(),s.debug("Geometry.setSize",{position:i.attributes.position})}}},Mesh:{enumerable:!1,value:class{constructor(e,n){const t=this;t.geometry=e,t.material=n,t.wireframe=!1,t.attributeInstances=[],Object.entries(t.geometry.attributes).forEach((([e,n])=>{t.attributeInstances.push({attribute:n,location:n.attach(e,t.material.program)})})),s.meshes.push(t),s.debug("Mesh.constructor",{mesh:t})}draw(){r.useProgram(this.material.program),this.material.uniformInstances.forEach((({uniform:e,location:n})=>e.update(n))),this.attributeInstances.forEach((({attribute:e,location:n})=>e.use(n))),r.drawElements(this.wireframe?r.LINES:r.TRIANGLES,this.geometry.attributes.index.values.length,r.UNSIGNED_SHORT,0)}remove(){s.meshes=s.meshes.filter((e=>e!=this))}}},Attribute:{enumerable:!1,value:class{constructor(e){this.type=r.FLOAT,this.normalized=!1,this.buffer=r.createBuffer(),Object.assign(this,e),this.update()}update(){void 0!==this.values&&(r.bindBuffer(this.target,this.buffer),r.bufferData(this.target,this.values,r.STATIC_DRAW))}attach(e,n){const t=r.getAttribLocation(n,e);return this.target===r.ARRAY_BUFFER&&(r.enableVertexAttribArray(t),r.vertexAttribPointer(t,this.size,this.type,this.normalized,0,0)),t}use(e){r.bindBuffer(this.target,this.buffer),this.target===r.ARRAY_BUFFER&&(r.enableVertexAttribArray(e),r.vertexAttribPointer(e,this.size,this.type,this.normalized,0,0))}}}});const a=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];s.commonUniforms={projectionMatrix:new s.Uniform({type:"mat4",value:a}),modelViewMatrix:new s.Uniform({type:"mat4",value:a}),resolution:new s.Uniform({type:"vec2",value:[1,1]}),aspectRatio:new s.Uniform({type:"float",value:1})}}setSize(e=640,n=480){this.width=e,this.height=n,this.canvas.width=e,this.canvas.height=n,this.gl.viewport(0,0,e,n),this.commonUniforms.resolution.value=[e,n],this.commonUniforms.aspectRatio.value=e/n,this.debug("MiniGL.setSize",{width:e,height:n})}setOrthographicCamera(e=0,n=0,t=0,i=-2e3,s=2e3){this.commonUniforms.projectionMatrix.value=[2/this.width,0,0,0,0,2/this.height,0,0,0,0,2/(i-s),0,e,n,t,1],this.debug("setOrthographicCamera",this.commonUniforms.projectionMatrix.value)}render(){this.gl.clearColor(0,0,0,0),this.gl.clearDepth(1),this.meshes.forEach((e=>e.draw()))}}function e(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}class Gradient{constructor(...n){e(this,"el",void 0),e(this,"cssVarRetries",0),e(this,"maxCssVarRetries",200),e(this,"angle",0),e(this,"isLoadedClass",!1),e(this,"isScrolling",!1),e(this,"scrollingTimeout",void 0),e(this,"scrollingRefreshDelay",200),e(this,"isIntersecting",!1),e(this,"shaderFiles",void 0),e(this,"vertexShader",void 0),e(this,"sectionColors",void 0),e(this,"computedCanvasStyle",void 0),e(this,"conf",void 0),e(this,"uniforms",void 0),e(this,"t",1253106),e(this,"last",0),e(this,"width",void 0),e(this,"minWidth",1111),e(this,"height",600),e(this,"xSegCount",void 0),e(this,"ySegCount",void 0),e(this,"mesh",void 0),e(this,"material",void 0),e(this,"geometry",void 0),e(this,"minigl",void 0),e(this,"scrollObserver",void 0),e(this,"amp",320),e(this,"seed",Math.floor(25*Math.random())+5),e(this,"freqX",14e-5),e(this,"freqY",29e-5),e(this,"freqDelta",1e-5),e(this,"activeColors",[1,1,1,1]),e(this,"isMetaKey",!1),e(this,"isGradientLegendVisible",!1),e(this,"isMouseDown",!1),e(this,"handleScroll",(()=>{clearTimeout(this.scrollingTimeout),this.scrollingTimeout=setTimeout(this.handleScrollEnd,this.scrollingRefreshDelay),this.isGradientLegendVisible&&this.hideGradientLegend(),this.conf.playing&&(this.isScrolling=!0,this.pause())})),e(this,"handleScrollEnd",(()=>{this.isScrolling=!1,this.isIntersecting&&this.play()})),e(this,"resize",(()=>{this.width=window.innerWidth,this.minigl.setSize(this.width,this.height),this.minigl.setOrthographicCamera(),this.xSegCount=Math.ceil(this.width*this.conf.density[0]),this.ySegCount=Math.ceil(this.height*this.conf.density[1]),this.mesh.geometry.setTopology(this.xSegCount,this.ySegCount),this.mesh.geometry.setSize(this.width,this.height),this.mesh.material.uniforms.u_shadow_power.value=this.width<600?5:6})),e(this,"handleMouseDown",(e=>{this.isGradientLegendVisible&&(this.isMetaKey=e.metaKey,this.isMouseDown=!0,!1===this.conf.playing&&requestAnimationFrame(this.animate))})),e(this,"handleMouseUp",(()=>{this.isMouseDown=!1})),e(this,"animate",(e=>{if(!this.shouldSkipFrame(e)||this.isMouseDown){if(this.t+=Math.min(e-this.last,1e3/15),this.last=e,this.isMouseDown){let e=160;this.isMetaKey&&(e=-160),this.t+=e}this.mesh.material.uniforms.u_time.value=this.t,this.minigl.render()}if(0!==this.last&&this.isStatic)return this.minigl.render(),void this.disconnect();(this.conf.playing||this.isMouseDown)&&requestAnimationFrame(this.animate)})),e(this,"addIsLoadedClass",(()=>{!this.isLoadedClass&&(this.isLoadedClass=!0,this.el.classList.add("isLoaded"),setTimeout((()=>{this.el.parentElement.classList.add("isLoaded")}),3e3))})),e(this,"pause",(()=>{this.conf.playing=!1})),e(this,"play",(()=>{requestAnimationFrame(this.animate),this.conf.playing=!0})),e(this,"initGradient",((e,n,t,i,s)=>(this.el=document.querySelector(e),this.connect(n,t,i,s),this)))}async connect(e,n,t,i){this.shaderFiles={vertex:"varying vec3 v_color;\n\nvoid main() {\n float time = u_time * u_global.noiseSpeed;\n\n vec2 noiseCoord = resolution * uvNorm * u_global.noiseFreq;\n\n vec2 st = 1. - uvNorm.xy;\n\n //\n // Tilting the plane\n //\n\n // Front-to-back tilt\n float tilt = resolution.y / 2.0 * uvNorm.y;\n\n // Left-to-right angle\n float incline = resolution.x * uvNorm.x / 2.0 * u_vertDeform.incline;\n\n // Up-down shift to offset incline\n float offset = resolution.x / 2.0 * u_vertDeform.incline * mix(u_vertDeform.offsetBottom, u_vertDeform.offsetTop, uv.y);\n\n //\n // Vertex noise\n //\n\n float noise = snoise(vec3(\n noiseCoord.x * u_vertDeform.noiseFreq.x + time * u_vertDeform.noiseFlow,\n noiseCoord.y * u_vertDeform.noiseFreq.y,\n time * u_vertDeform.noiseSpeed + u_vertDeform.noiseSeed\n )) * u_vertDeform.noiseAmp;\n\n // Fade noise to zero at edges\n noise *= 1.0 - pow(abs(uvNorm.y), 2.0);\n\n // Clamp to 0\n noise = max(0.0, noise);\n\n vec3 pos = vec3(\n position.x,\n position.y + tilt + incline + noise - offset,\n position.z\n );\n\n //\n // Vertex color, to be passed to fragment shader\n //\n\n if (u_active_colors[0] == 1.) {\n v_color = u_baseColor;\n }\n\n for (int i = 0; i < u_waveLayers_length; i++) {\n if (u_active_colors[i + 1] == 1.) {\n WaveLayers layer = u_waveLayers[i];\n\n float noise = smoothstep(\n layer.noiseFloor,\n layer.noiseCeil,\n snoise(vec3(\n noiseCoord.x * layer.noiseFreq.x + time * layer.noiseFlow,\n noiseCoord.y * layer.noiseFreq.y,\n time * layer.noiseSpeed + layer.noiseSeed\n )) / 2.0 + 0.5\n );\n\n v_color = blendNormal(v_color, layer.color, pow(noise, 4.));\n }\n }\n\n //\n // Finish\n //\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n}",noise:"//\n// Description : Array and textureless GLSL 2D/3D/4D simplex\n// noise functions.\n// Author : Ian McEwan, Ashima Arts.\n// Maintainer : stegu\n// Lastmod : 20110822 (ijm)\n// License : Copyright (C) 2011 Ashima Arts. All rights reserved.\n// Distributed under the MIT License. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n// https://github.com/stegu/webgl-noise\n//\n\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 permute(vec4 x) {\n return mod289(((x*34.0)+1.0)*x);\n}\n\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n\nfloat snoise(vec3 v)\n{\n const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\n// First corner\n vec3 i = floor(v + dot(v, C.yyy) );\n vec3 x0 = v - i + dot(i, C.xxx) ;\n\n// Other corners\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min( g.xyz, l.zxy );\n vec3 i2 = max( g.xyz, l.zxy );\n\n // x0 = x0 - 0.0 + 0.0 * C.xxx;\n // x1 = x0 - i1 + 1.0 * C.xxx;\n // x2 = x0 - i2 + 2.0 * C.xxx;\n // x3 = x0 - 1.0 + 3.0 * C.xxx;\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y\n\n// Permutations\n i = mod289(i);\n vec4 p = permute( permute( permute(\n i.z + vec4(0.0, i1.z, i2.z, 1.0 ))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))\n + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n\n// Gradients: 7x7 points over a square, mapped onto an octahedron.\n// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857; // 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)\n\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n\n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n\n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n\n //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;\n //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;\n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n\n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;\n\n vec3 p0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1.xy,h.z);\n vec3 p3 = vec3(a1.zw,h.w);\n\n//Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n\n// Mix final noise value\n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),\n dot(p2,x2), dot(p3,x3) ) );\n}",blend:"//\n// https://github.com/jamieowen/glsl-blend\n//\n\n// Normal\n\nvec3 blendNormal(vec3 base, vec3 blend) {\n\treturn blend;\n}\n\nvec3 blendNormal(vec3 base, vec3 blend, float opacity) {\n\treturn (blendNormal(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Screen\n\nfloat blendScreen(float base, float blend) {\n\treturn 1.0-((1.0-base)*(1.0-blend));\n}\n\nvec3 blendScreen(vec3 base, vec3 blend) {\n\treturn vec3(blendScreen(base.r,blend.r),blendScreen(base.g,blend.g),blendScreen(base.b,blend.b));\n}\n\nvec3 blendScreen(vec3 base, vec3 blend, float opacity) {\n\treturn (blendScreen(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Multiply\n\nvec3 blendMultiply(vec3 base, vec3 blend) {\n\treturn base*blend;\n}\n\nvec3 blendMultiply(vec3 base, vec3 blend, float opacity) {\n\treturn (blendMultiply(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Overlay\n\nfloat blendOverlay(float base, float blend) {\n\treturn base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend));\n}\n\nvec3 blendOverlay(vec3 base, vec3 blend) {\n\treturn vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b));\n}\n\nvec3 blendOverlay(vec3 base, vec3 blend, float opacity) {\n\treturn (blendOverlay(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Hard light\n\nvec3 blendHardLight(vec3 base, vec3 blend) {\n\treturn blendOverlay(blend,base);\n}\n\nvec3 blendHardLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendHardLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Soft light\n\nfloat blendSoftLight(float base, float blend) {\n\treturn (blend<0.5)?(2.0*base*blend+base*base*(1.0-2.0*blend)):(sqrt(base)*(2.0*blend-1.0)+2.0*base*(1.0-blend));\n}\n\nvec3 blendSoftLight(vec3 base, vec3 blend) {\n\treturn vec3(blendSoftLight(base.r,blend.r),blendSoftLight(base.g,blend.g),blendSoftLight(base.b,blend.b));\n}\n\nvec3 blendSoftLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendSoftLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Color dodge\n\nfloat blendColorDodge(float base, float blend) {\n\treturn (blend==1.0)?blend:min(base/(1.0-blend),1.0);\n}\n\nvec3 blendColorDodge(vec3 base, vec3 blend) {\n\treturn vec3(blendColorDodge(base.r,blend.r),blendColorDodge(base.g,blend.g),blendColorDodge(base.b,blend.b));\n}\n\nvec3 blendColorDodge(vec3 base, vec3 blend, float opacity) {\n\treturn (blendColorDodge(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Color burn\n\nfloat blendColorBurn(float base, float blend) {\n\treturn (blend==0.0)?blend:max((1.0-((1.0-base)/blend)),0.0);\n}\n\nvec3 blendColorBurn(vec3 base, vec3 blend) {\n\treturn vec3(blendColorBurn(base.r,blend.r),blendColorBurn(base.g,blend.g),blendColorBurn(base.b,blend.b));\n}\n\nvec3 blendColorBurn(vec3 base, vec3 blend, float opacity) {\n\treturn (blendColorBurn(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Vivid Light\n\nfloat blendVividLight(float base, float blend) {\n\treturn (blend<0.5)?blendColorBurn(base,(2.0*blend)):blendColorDodge(base,(2.0*(blend-0.5)));\n}\n\nvec3 blendVividLight(vec3 base, vec3 blend) {\n\treturn vec3(blendVividLight(base.r,blend.r),blendVividLight(base.g,blend.g),blendVividLight(base.b,blend.b));\n}\n\nvec3 blendVividLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendVividLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Lighten\n\nfloat blendLighten(float base, float blend) {\n\treturn max(blend,base);\n}\n\nvec3 blendLighten(vec3 base, vec3 blend) {\n\treturn vec3(blendLighten(base.r,blend.r),blendLighten(base.g,blend.g),blendLighten(base.b,blend.b));\n}\n\nvec3 blendLighten(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLighten(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Linear burn\n\nfloat blendLinearBurn(float base, float blend) {\n\t// Note : Same implementation as BlendSubtractf\n\treturn max(base+blend-1.0,0.0);\n}\n\nvec3 blendLinearBurn(vec3 base, vec3 blend) {\n\t// Note : Same implementation as BlendSubtract\n\treturn max(base+blend-vec3(1.0),vec3(0.0));\n}\n\nvec3 blendLinearBurn(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLinearBurn(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Linear dodge\n\nfloat blendLinearDodge(float base, float blend) {\n\t// Note : Same implementation as BlendAddf\n\treturn min(base+blend,1.0);\n}\n\nvec3 blendLinearDodge(vec3 base, vec3 blend) {\n\t// Note : Same implementation as BlendAdd\n\treturn min(base+blend,vec3(1.0));\n}\n\nvec3 blendLinearDodge(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLinearDodge(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Linear light\n\nfloat blendLinearLight(float base, float blend) {\n\treturn blend<0.5?blendLinearBurn(base,(2.0*blend)):blendLinearDodge(base,(2.0*(blend-0.5)));\n}\n\nvec3 blendLinearLight(vec3 base, vec3 blend) {\n\treturn vec3(blendLinearLight(base.r,blend.r),blendLinearLight(base.g,blend.g),blendLinearLight(base.b,blend.b));\n}\n\nvec3 blendLinearLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLinearLight(base, blend) * opacity + base * (1.0 - opacity));\n}",fragment:"varying vec3 v_color;\n\nvoid main() {\n vec3 color = v_color;\n if (u_darken_top == 1.0) {\n vec2 st = gl_FragCoord.xy/resolution.xy;\n color.g -= pow(st.y + sin(-12.0) * st.x, u_shadow_power) * 0.4;\n }\n gl_FragColor = vec4(color, 1.0);\n}"},this.conf={presetName:"",wireframe:!1,density:[.06,.16],zoom:1,rotation:0,playing:!0},document.querySelectorAll("canvas").length<1?console.log("DID NOT LOAD CANVAS"):(this.minigl=new MiniGl(this.el,null,null,!0),requestAnimationFrame((()=>{this.el&&(this.computedCanvasStyle=getComputedStyle(this.el),this.waitForCssVars(e,n,t,i))})))}disconnect(){this.scrollObserver&&(window.removeEventListener("scroll",this.handleScroll),window.removeEventListener("mousedown",this.handleMouseDown),window.removeEventListener("mouseup",this.handleMouseUp),window.removeEventListener("keydown",this.handleKeyDown),this.scrollObserver.disconnect()),window.removeEventListener("resize",this.resize)}initMaterial(){this.uniforms={u_time:new this.minigl.Uniform({value:0}),u_shadow_power:new this.minigl.Uniform({value:5}),u_darken_top:new this.minigl.Uniform({value:""===this.el.dataset.jsDarkenTop?1:0}),u_active_colors:new this.minigl.Uniform({value:this.activeColors,type:"vec4"}),u_global:new this.minigl.Uniform({value:{noiseFreq:new this.minigl.Uniform({value:[this.freqX,this.freqY],type:"vec2"}),noiseSpeed:new this.minigl.Uniform({value:5e-6})},type:"struct"}),u_vertDeform:new this.minigl.Uniform({value:{incline:new this.minigl.Uniform({value:Math.sin(this.angle)/Math.cos(this.angle)}),offsetTop:new this.minigl.Uniform({value:-.5}),offsetBottom:new this.minigl.Uniform({value:-.5}),noiseFreq:new this.minigl.Uniform({value:[3,4],type:"vec2"}),noiseAmp:new this.minigl.Uniform({value:this.amp}),noiseSpeed:new this.minigl.Uniform({value:10}),noiseFlow:new this.minigl.Uniform({value:3}),noiseSeed:new this.minigl.Uniform({value:this.seed})},type:"struct",excludeFrom:"fragment"}),u_baseColor:new this.minigl.Uniform({value:this.sectionColors[0],type:"vec3",excludeFrom:"fragment"}),u_waveLayers:new this.minigl.Uniform({value:[],excludeFrom:"fragment",type:"array"})};for(let e=1;e<this.sectionColors.length;e+=1)this.uniforms.u_waveLayers.value.push(new this.minigl.Uniform({value:{color:new this.minigl.Uniform({value:this.sectionColors[e],type:"vec3"}),noiseFreq:new this.minigl.Uniform({value:[2+e/this.sectionColors.length,3+e/this.sectionColors.length],type:"vec2"}),noiseSpeed:new this.minigl.Uniform({value:11+.3*e}),noiseFlow:new this.minigl.Uniform({value:6.5+.3*e}),noiseSeed:new this.minigl.Uniform({value:this.seed+10*e}),noiseFloor:new this.minigl.Uniform({value:.1}),noiseCeil:new this.minigl.Uniform({value:.63+.07*e})},type:"struct"}));return this.vertexShader=[this.shaderFiles.noise,this.shaderFiles.blend,this.shaderFiles.vertex].join("\n\n"),new this.minigl.Material(this.vertexShader,this.shaderFiles.fragment,this.uniforms)}initMesh(){this.material=this.initMaterial(),this.geometry=new this.minigl.PlaneGeometry,this.mesh=new this.minigl.Mesh(this.geometry,this.material)}shouldSkipFrame(e){return!!window.document.hidden||!this.conf.playing||parseInt(e,10)%2==0||void 0}updateFrequency(e){this.freqX+=e,this.freqY+=e}toggleColor(e){this.activeColors[e]=0===this.activeColors[e]?1:0}showGradientLegend(){this.width>this.minWidth&&(this.isGradientLegendVisible=!0,document.body.classList.add("isGradientLegendVisible"))}hideGradientLegend(){this.isGradientLegendVisible=!1,document.body.classList.remove("isGradientLegendVisible")}init(e,n,t,i){this.initGradientColors(e,n,t,i),this.initMesh(),this.resize(),requestAnimationFrame(this.animate),window.addEventListener("resize",this.resize)}waitForCssVars(e,n,t,i){if(this.computedCanvasStyle&&-1!==e.indexOf("#"))this.init(e,n,t,i),this.addIsLoadedClass();else{if(this.cssVarRetries+=1,this.cssVarRetries>this.maxCssVarRetries)return this.sectionColors=[16711680,16711680,16711935,65280,255],void this.init(e,n,t,i);requestAnimationFrame((()=>this.waitForCssVars(e,n,t,i)))}}initGradientColors(e,n,t,i){this.sectionColors=[e,n,t,i].map((e=>{if(4===e.length){const n=e.substr(1).split("").map((e=>e+e)).join("");e=`#${n}`}return e&&`0x${e.substr(1)}`})).filter(Boolean).map(normalizeColor)}}
|
|
let gradient = new Gradient();
|
|
gradient.initGradient("#background", "#aa5cc3","#00a4dc", "#003C50", "#3E2247");
|
|
</script>
|
|
</body>
|
|
</html> |