{"version":3,"file":"orbsBackground-CQMtfnhb.js","sources":["../../../../../src/scripts/modules/orbsBackground.ts"],"sourcesContent":["import { Component } from '@verndale/core';\n\nclass OrbsBackground extends Component {\n constructor(el: HTMLElement) {\n super(el);\n }\n\n setupDefaults() {\n this.dom = {\n el: this.el\n };\n\n const getPageHeight = this.getPageHeight();\n //create orbs and append them to the dom. calculate the number of orbs based on the height of the page divided by 66% of the width\n const numberOfOrbs = Math.floor(getPageHeight / (window.innerWidth * 0.66));\n\n for (let i = 0; i < numberOfOrbs; i++) {\n const orb = document.createElement('div');\n orb.classList.add('orbs-background__orb-item');\n orb.style.top = `${i * (window.innerWidth * 0.75)}px`;\n //offset a little bit the horizontal positive and negative position of the orbs randomly\n orb.style.left = `${Math.floor(Math.random() * 10) % 2 === 0 ? -1 : 1} * ${Math.floor(Math.random() * 10)}px`;\n (this.dom.el as HTMLElement).appendChild(orb);\n }\n\n requestAnimationFrame(() => {\n (this.dom.el as HTMLElement).classList.add('loaded');\n });\n }\n\n addListeners() {\n window.matchMedia('(min-width: 768px)').onchange = () => {\n this.el.innerHTML = '';\n this.setupDefaults();\n };\n }\n\n getPageHeight() {\n const body = document.body,\n html = document.documentElement;\n\n const height = Math.max(\n body.scrollHeight,\n body.offsetHeight,\n html.clientHeight,\n html.scrollHeight,\n html.offsetHeight\n );\n\n return height;\n }\n}\n\nexport default OrbsBackground;\n"],"names":["OrbsBackground","Component","el","getPageHeight","numberOfOrbs","i","orb","body","html"],"mappings":"yCAEA,MAAMA,UAAuBC,CAAU,CACrC,YAAYC,EAAiB,CAC3B,MAAMA,CAAE,CACV,CAEA,eAAgB,CACd,KAAK,IAAM,CACT,GAAI,KAAK,EAAA,EAGL,MAAAC,EAAgB,KAAK,gBAErBC,EAAe,KAAK,MAAMD,GAAiB,OAAO,WAAa,IAAK,EAE1E,QAASE,EAAI,EAAGA,EAAID,EAAcC,IAAK,CAC/B,MAAAC,EAAM,SAAS,cAAc,KAAK,EACpCA,EAAA,UAAU,IAAI,2BAA2B,EAC7CA,EAAI,MAAM,IAAM,GAAGD,GAAK,OAAO,WAAa,IAAK,KAE7CC,EAAA,MAAM,KAAO,GAAG,KAAK,MAAM,KAAK,OAAA,EAAW,EAAE,EAAI,IAAM,EAAI,GAAK,CAAC,MAAM,KAAK,MAAM,KAAK,OAAW,EAAA,EAAE,CAAC,KACxG,KAAK,IAAI,GAAmB,YAAYA,CAAG,CAC9C,CAEA,sBAAsB,IAAM,CACzB,KAAK,IAAI,GAAmB,UAAU,IAAI,QAAQ,CAAA,CACpD,CACH,CAEA,cAAe,CACb,OAAO,WAAW,oBAAoB,EAAE,SAAW,IAAM,CACvD,KAAK,GAAG,UAAY,GACpB,KAAK,cAAc,CAAA,CAEvB,CAEA,eAAgB,CACd,MAAMC,EAAO,SAAS,KACpBC,EAAO,SAAS,gBAUX,OARQ,KAAK,IAClBD,EAAK,aACLA,EAAK,aACLC,EAAK,aACLA,EAAK,aACLA,EAAK,YAAA,CAIT,CACF"}