From a560ad1e2653e01cebfdd8ac950748223e954149 Mon Sep 17 00:00:00 2001 From: 7PH Date: Fri, 31 May 2024 00:01:52 +0200 Subject: [PATCH] Publish v2.3.3 --- dist/powerglitch.min.js | 2 +- docs/api-docs/functions/mergeOptions.html | 2 +- docs/api-docs/types/GlitchPartialOptions.html | 2 +- docs/api-docs/types/GlitchResult.html | 2 +- docs/api-docs/types/GlitchableElement.html | 2 +- docs/api-docs/types/LayerDefinition.html | 2 +- docs/api-docs/types/PlayModes.html | 2 +- docs/api-docs/types/PowerGlitchOptions.html | 2 +- docs/api-docs/types/RecursivePartial.html | 2 +- docs/api-docs/variables/PowerGlitch.html | 2 +- docs/assets/{index-2d680928.js => index-a2d2f84a.js} | 2 +- docs/index.html | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) rename docs/assets/{index-2d680928.js => index-a2d2f84a.js} (97%) diff --git a/dist/powerglitch.min.js b/dist/powerglitch.min.js index 08e0443..be9e76e 100644 --- a/dist/powerglitch.min.js +++ b/dist/powerglitch.min.js @@ -1 +1 @@ -(function(g){"use strict";var _=Object.defineProperty,$=Object.defineProperties,C=Object.getOwnPropertyDescriptors,p=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable,y=(t,e,n)=>e in t?_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,d=(t,e)=>{for(var n in e||(e={}))P.call(e,n)&&y(t,n,e[n]);if(p)for(var n of p(e))G.call(e,n)&&y(t,n,e[n]);return t},M=(t,e)=>$(t,C(e));const v=(t="always")=>({playMode:t,createContainers:!0,hideOverflow:!1,timing:t==="always"?{duration:2*1e3,iterations:1/0}:{duration:250,iterations:1},glitchTimeSpan:t==="always"?{start:.5,end:.7}:{start:0,end:1},shake:{velocity:15,amplitudeX:.2,amplitudeY:.2},slice:t==="click"?{count:15,velocity:20,minHeight:.02,maxHeight:.15,hueRotate:!0}:{count:6,velocity:15,minHeight:.02,maxHeight:.15,hueRotate:!0},pulse:!1}),w=(t,e)=>{if(!t.glitchTimeSpan)return 1;const n=t.glitchTimeSpan.start,r=t.glitchTimeSpan.end;if(er)return 0;const a=n+(r-n)/2;return e(Math.random()-.5)*2*w(t,e),O=({minHeight:t,maxHeight:e,minWidth:n,maxWidth:r})=>{const a=Math.floor(Math.random()*((e-t)*100+1))+t*100,s=Math.floor(Math.random()*((r-n)*100+1))+n*100,i=Math.floor(Math.random()*(100-a)),c=Math.floor(Math.random()*(100-s)),h=`${c+s}% ${i}%`,l=`${c+s}% ${i+a}%`,o=`${c}% ${i+a}%`,f=`${c}% ${i}%`;return`polygon(${h},${l},${o},${f})`},b=t=>{const e=Math.floor(t.slice.velocity*t.timing.duration/1e3)+1,n=[];for(let r=0;rt.pulse?{steps:[{transform:"scale(1)",opacity:"1"},{transform:`scale(${t.pulse.scale})`,opacity:"0"}],timing:M(d({},t.timing),{delay:(t.glitchTimeSpan?t.glitchTimeSpan.start:0)*t.timing.duration,easing:"ease-in-out"})}:null,L=t=>{if(!t.shake)return{steps:[],timing:{}};const e=Math.floor(t.shake.velocity*t.timing.duration/1e3)+1,n=[];for(let r=0;r[L(t),A(t),...Array.from({length:t.slice.count}).map(()=>b(t))].filter(e=>e!==null),m=(...t)=>{const e=n=>n&&typeof n=="object";return t.reduce((n,r)=>(Object.keys(r).forEach(a=>{e(n[a])&&e(r[a])?n[a]=m(n[a],r[a]):r[a]!==void 0&&(n[a]=r[a])}),n),{})},H=(t,e)=>{var n,r;if(!e.createContainers)return{container:t,layersContainer:t,glitched:t.firstElementChild};if(!t.dataset.glitched){const i=document.createElement("div"),c=document.createElement("div");return getComputedStyle(t).getPropertyValue("display").match(/^inline/)&&(c.style.display="inline-block"),c.appendChild(i),(n=t.parentElement)==null||n.insertBefore(c,t),i.prepend(t),{container:c,layersContainer:i,glitched:t}}const a=t.parentElement,s=(r=t.parentElement)==null?void 0:r.parentElement;for(;a.children.length>1;)a.removeChild(a.children[1]);return a.firstElementChild.getAnimations().forEach(i=>i.cancel()),{container:s,layersContainer:a,glitched:t}},R=(t,e,n)=>{const{glitched:r,container:a,layersContainer:s}=H(t,n);s.style.display="grid",n.hideOverflow&&(a.style.overflow="hidden"),n.html&&(r.innerHTML=n.html),r.style.gridArea="1/1/-1/-1";const i=r.cloneNode(!0);i.style.gridArea="1/1/-1/-1",i.style.userSelect="none",i.style.pointerEvents="none",i.style.opacity="0";for(let l=0;l{e.forEach((l,o)=>{s.children[o].animate(l.steps,l.timing)})},h=()=>{e.forEach((l,o)=>{s.children[o].getAnimations().forEach(f=>{f.cancel()})})};switch(a.onmouseenter=null,a.onmouseleave=null,a.onclick=null,n.playMode){case"always":c();break;case"hover":a.onmouseenter=c,a.onmouseleave=h;break;case"click":a.onclick=()=>{h(),c()};break}return t.dataset.glitched="1",{container:a,startGlitch:c,stopGlitch:h}},T={glitch:(t=".powerglitch",e={})=>{const n=m(v(e.playMode),e);let r=[];typeof t=="string"?r=Array.from(document.querySelectorAll(t)):t instanceof NodeList?r=Array.from(t):Array.isArray(t)?r=t:t instanceof HTMLElement&&(r=[t]);const a=E(n),s=r.map(i=>R(i,a,n));return{containers:s.map(i=>i.container),startGlitch:()=>s.forEach(i=>i.startGlitch()),stopGlitch:()=>s.forEach(i=>i.stopGlitch())}},generateLayers:E,getDefaultOptions:v};g.PowerGlitch=T,g.mergeOptions=m})(this.window=this.window||{}); +(function(g){"use strict";var _=Object.defineProperty,$=Object.defineProperties,C=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable,p=(t,e,r)=>e in t?_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,d=(t,e)=>{for(var r in e||(e={}))P.call(e,r)&&p(t,r,e[r]);if(y)for(var r of y(e))G.call(e,r)&&p(t,r,e[r]);return t},M=(t,e)=>$(t,C(e));const v=(t="always")=>({playMode:t,createContainers:!0,hideOverflow:!1,timing:t==="always"?{duration:2*1e3,iterations:1/0}:{duration:250,iterations:1},glitchTimeSpan:t==="always"?{start:.5,end:.7}:{start:0,end:1},shake:{velocity:15,amplitudeX:.2,amplitudeY:.2},slice:t==="click"?{count:15,velocity:20,minHeight:.02,maxHeight:.15,hueRotate:!0}:{count:6,velocity:15,minHeight:.02,maxHeight:.15,hueRotate:!0},pulse:!1}),w=(t,e)=>{if(!t.glitchTimeSpan)return 1;const r=t.glitchTimeSpan.start,n=t.glitchTimeSpan.end;if(en)return 0;const a=r+(n-r)/2;return e(Math.random()-.5)*2*w(t,e),O=({minHeight:t,maxHeight:e,minWidth:r,maxWidth:n})=>{const a=Math.floor(Math.random()*((e-t)*100+1))+t*100,s=Math.floor(Math.random()*((n-r)*100+1))+r*100,i=Math.floor(Math.random()*(100-a)),c=Math.floor(Math.random()*(100-s)),h=`${c+s}% ${i}%`,l=`${c+s}% ${i+a}%`,o=`${c}% ${i+a}%`,m=`${c}% ${i}%`;return`polygon(${h},${l},${o},${m})`},b=t=>{const e=Math.floor(t.slice.velocity*t.timing.duration/1e3)+1,r=[];for(let n=0;nt.pulse?{steps:[{transform:"scale(1)",opacity:"1"},{transform:`scale(${t.pulse.scale})`,opacity:"0"}],timing:M(d({},t.timing),{delay:(t.glitchTimeSpan?t.glitchTimeSpan.start:0)*t.timing.duration,easing:"ease-in-out"})}:null,L=t=>{if(!t.shake)return{steps:[],timing:{}};const e=Math.floor(t.shake.velocity*t.timing.duration/1e3)+1,r=[];for(let n=0;n[L(t),A(t),...Array.from({length:t.slice.count}).map(()=>b(t))].filter(e=>e!==null),f=(...t)=>{const e=r=>r&&typeof r=="object";return t.reduce((r,n)=>(Object.keys(n).forEach(a=>{e(r[a])&&e(n[a])?r[a]=f(r[a],n[a]):n[a]!==void 0&&(r[a]=n[a])}),r),{})},H=(t,e)=>{var r,n;if(!e.createContainers)return{container:t,layersContainer:t,glitched:t.firstElementChild};if(!t.dataset.glitched){const i=document.createElement("div"),c=document.createElement("div");return getComputedStyle(t).getPropertyValue("display").match(/^inline/)&&(c.style.display="inline-block"),c.appendChild(i),(r=t.parentElement)==null||r.insertBefore(c,t),i.prepend(t),{container:c,layersContainer:i,glitched:t}}const a=t.parentElement,s=(n=t.parentElement)==null?void 0:n.parentElement;for(;a.children.length>1;)a.removeChild(a.children[1]);return a.firstElementChild.getAnimations().forEach(i=>i.cancel()),{container:s,layersContainer:a,glitched:t}},R=(t,e,r)=>{const{glitched:n,container:a,layersContainer:s}=H(t,r);s.style.display="grid",r.hideOverflow&&(a.style.overflow="hidden"),r.html&&(n.innerHTML=r.html),n.style.gridArea="1/1/-1/-1";const i=n.cloneNode(!0);i.dataset.islayer="true",i.style.gridArea="1/1/-1/-1",i.style.userSelect="none",i.style.pointerEvents="none",i.style.opacity="0";for(let l=0;l{e.forEach((l,o)=>{s.children[o].animate(l.steps,l.timing)})},h=()=>{e.forEach((l,o)=>{s.children[o].getAnimations().forEach(m=>{m.cancel()})})};switch(a.onmouseenter=null,a.onmouseleave=null,a.onclick=null,r.playMode){case"always":c();break;case"hover":a.onmouseenter=c,a.onmouseleave=h;break;case"click":a.onclick=()=>{h(),c()};break}return t.dataset.glitched="1",{container:a,startGlitch:c,stopGlitch:h}},T={glitch:(t=".powerglitch",e={})=>{const r=f(v(e.playMode),e);let n=[];typeof t=="string"?n=Array.from(document.querySelectorAll(t)):t instanceof NodeList?n=Array.from(t):Array.isArray(t)?n=t:t instanceof HTMLElement&&(n=[t]);const a=E(r),s=n.filter(i=>!i.dataset.islayer).map(i=>R(i,a,r));return{containers:s.map(i=>i.container),startGlitch:()=>s.forEach(i=>i.startGlitch()),stopGlitch:()=>s.forEach(i=>i.stopGlitch())}},generateLayers:E,getDefaultOptions:v};g.PowerGlitch=T,g.mergeOptions=f})(this.window=this.window||{}); diff --git a/docs/api-docs/functions/mergeOptions.html b/docs/api-docs/functions/mergeOptions.html index d230db3..8dd253e 100644 --- a/docs/api-docs/functions/mergeOptions.html +++ b/docs/api-docs/functions/mergeOptions.html @@ -33,7 +33,7 @@
Rest Returns any
+
  • Defined in index.ts:348
  • +
  • Defined in index.ts:515
  • +
  • Defined in index.ts:525
  • +
  • Defined in index.ts:520
  • +
  • Defined in index.ts:155
  • +
  • Defined in index.ts:9
  • +
  • Defined in index.ts:14
  • +
  • Defined in index.ts:589