/
/
home
/
melaqxso
/
public_html
/
wp-content
/
themes
/
hub
/
assets
/
js
/
animated-blob
Server: server63.web-hosting.com (198.54.116.184)
You: 216.73.216.61
PHP 7.4.33
Dir:
/home/melaqxso/public_html/wp-content/themes/hub/assets/js/animated-blob
Edit:
/home/melaqxso/public_html/wp-content/themes/hub/assets/js/animated-blob/liquidAnimatedBlob.min.js
!function($){"use strict";const t="liquidAnimatedBlob";let e={id:"lqd-blob-"+100*Math.random().toFixed(2),width:512,height:512,radius:120,speed:1,amplitude:2,anchorPoints:4,gradientType:"linear",colors:["#50F6C2","#80FFF2"]};class n{constructor(n,i){this._defaults=e,this._name=t,this.options={...e,...i},this.DOM={},this.DOM.element=n,this.DOM.svg=this.DOM.element.querySelector("svg"),this.DOM.svg&&(this.gradientPath=`lqd-blob-gradient-${this.options.id}`,fastdomPromised.mutate((()=>{this.init()})))}init(){const{width:t,height:e,amplitude:n,radius:i,anchorPoints:a}=this.options,s="http://www.w3.org/2000/svg",o=this.DOM.svg,h=undefined,r=undefined,d=t/2-.95*i,c=e/2-1.5*i,l=i/Math.max(Math.min(a,7),4)*n,u=document.createElementNS(s,"defs");o.appendChild(u),u.appendChild(this.createGradient(s));const p=document.createElementNS(s,"g");o.appendChild(p);const m=document.createElementNS(s,"path");m.setAttributeNS(null,"fill",`url(${window.location.href}#${this.gradientPath})`),p.appendChild(m);const x=o&&a*i===o.hash&&o.nodes||this.createNodes(i,d,c,l),b=o&&a*i===o.hash&&o.controlPoints||this.createControlPoints(x,i,d,c);this.drawBlobPath(x,b,m),o.nodes=x,o.controlPoints=b,o.hash=a*i,this.update(x,b,l),this.drawBlobPath(x,b,m)}createGradient(t){const{colors:e}=this.options,n=document.createElementNS(t,`${this.options.gradientType}Gradient`);return n.setAttributeNS(null,"id",this.gradientPath),e.forEach(((i,a)=>{const s=document.createElementNS(t,"stop");s.setAttributeNS(null,"offset",a/(e.length-1)*100+"%"),s.setAttributeNS(null,"stop-color",i),n.appendChild(s)})),n}createNodes(t,e,n){let i=this.options.anchorPoints,a=[],s=2*t,o=2*t,h,r,d;for(let o=0;o<i;o++)h=o/(i/2)*Math.PI,r=t*Math.cos(h)+s/2,d=t*Math.sin(h)+s/2,a.push({id:o,x:r+e,y:d+n,prevX:r+e,prevY:d+n,nextX:r+e,nextY:d+n,baseX:r+e,baseY:d+n,angle:h});return a}createControlPoints(t,e,n,i){const a=4/3*Math.tan(Math.PI/(2*this.options.anchorPoints))*e,s={c1x:t[0].x,c1y:t[0].y-a,c2x:t[0].x,c2y:t[0].y+a};return t.map(((t,a)=>{if(0===a)return s;{const a=-t.angle,o=this.rotate(e+n,e+i,s.c1x,s.c1y,a),h=this.rotate(e+n,e+i,s.c2x,s.c2y,a);return{c1x:o[0],c1y:o[1],c2x:h[0],c2y:h[1]}}}))}update(t,e,n){t.forEach(((i,a)=>{if(Math.abs(t[a].nextX-t[a].x)<10){const e=(~~(5*Math.random())-2)*Math.random()*n/2;t[a].prevX=t[a].x,t[a].nextX=t[a].baseX+e}if(Math.abs(t[a].nextY-t[a].y)<10){const e=(~~(5*Math.random())-2)*Math.random()*n/2;t[a].prevY=t[a].y,t[a].nextY=t[a].baseY+e}const s=t[a].nextX-t[a].prevX,o=t[a].nextY-t[a].prevY,h=undefined,r=undefined;let d=1-(t[a].nextX-t[a].x)/s,c=1-(t[a].nextY-t[a].y)/o;const l=this.ease(d>0?d:.2)*s,u=this.ease(c>0?c:.2)*o;t[a].x+=l,t[a].y+=u,e[a].c1x+=l,e[a].c1y+=u,e[a].c2x+=l,e[a].c2y+=u})),this.updateAF=requestAnimationFrame(this.update.bind(this,t,e,n))}drawBlobPath(t,e,n){n.setAttributeNS(null,"d",`\n\t\t\t\tM${t[t.length-1].x} ${t[t.length-1].y}\n\t\t\t\t${t.map(((t,n)=>`\n\t\t\t\tC ${0===n?e[e.length-1].c2x:e[n-1].c2x} ${0===n?e[e.length-1].c2y:e[n-1].c2y}, ${e[n].c1x} ${e[n].c1y}, ${t.x} ${t.y}\n\t\t\t\t`)).join("")}\n\t\t\t\tZ\n\t\t\t`),this.drawBlobPathAF=requestAnimationFrame(this.drawBlobPath.bind(this,t,e,n))}ease(t){return-(Math.cos(Math.PI/2*t*5)-2)/256*this.options.speed}rotate(t,e,n,i,a){const s=Math.cos(a),o=Math.sin(a),h=undefined,r=undefined;return[s*(n-t)+o*(i-e)+t,s*(i-e)-o*(n-t)+e]}destroy(){this.updateAF&&cancelAnimationFrame(this.updateAF),this.drawBlobPathAF&&cancelAnimationFrame(this.drawBlobPathAF)}}$.fn[t]=function(e){return this.each((function(){const i={...$(this).data("blob-options"),...e};$.data(this,"plugin_"+t)||$.data(this,"plugin_"+t,new n(this,i))}))}}(jQuery),jQuery(document).ready((function($){$("[data-lqd-animated-blob]").liquidAnimatedBlob()}));
Ukuran: 3.6 KB