PageSourceSearch

https://niallhoran.com/cdn/shop/t/56/assets/3750498b197793c7e358_particle-animation-chunk_build.js

js niallhoran.com collected 2026-09-24 21:09:21 UTC 3,700 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkgcom_rhythm=self.webpackChunkgcom_rhythm||[]).push([[3096],{7509(t,e,i){i.d(e,{ParticleAnimation:()=>n});var s=i(5593);class n{constructor(t){this.container=t,this.image=t.dataset.image||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAQAAABuvaSwAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAE7SURBVCjPnZMvcoNAGMWhdJgGhkYkw1CBSyaCGURcTDSGih4gFwiOE0RGIivTK2C5ArKVkXE9w+tvKS2223nm8b3f7n77B0fOr1zdIU/3o7zh252ICXQHzNdMgUIU4PxhiPszYJrTgIHmWijWE4pxcypmwDj/hD4o0lKp1sqUowyXUolIRvwbNuijEq201V6FnlGB21JJSAw+wKZXn/GJNtqp1EGValThSiobkgiC3p2hhYDlVgQvOuqkRq+owR2p7EiWELRiYJ+NpCxZEp71plYdanFnKiVJCuEb2OOIFmxmz7InXcB6faAed6FyIFlDzOQ5QxMxey/osmG+Xlfd0BXXUqlIMggaMXDIqebsv6bTTu+An+iG66jUJDlE+A/Yog2rDVodndWlWF231UOyfKJWj9/yt/rjD/sF+2xJiwvIrtcAAAASdEVYdEVYSUY6T3JpZW50YXRpb24AMYRY7O8AAAAASUVORK5CYII=",this.density=function(t,e){const{input:i,output:s}=e,n=((t=Math.min(Math.max(t,i.min),i.max))-i.min)/(i.max-i.min),a=s.min+n*(s.max-s.min);return Math.round(a)}(parseInt(t.dataset.density||"75",10),{input:{min:1,max:100},output:{min:20,max:500}}),this.size=parseInt(t.dataset.size||"20",10),this.speed=parseInt(t.dataset.speed||"6",10),this.fps=30,this.fpsInterval=1e3/this.fps,this.lastFrameTime=0,this.camera=new s.ubm(75,window.innerWidth/window.innerHeight,1,2e3),this.camera.position.z=1e3,this.scene=new s.Z58,this.sceneWidth=2e3,this.sceneHeight=2e3;const e=new Float32Array(3*this.density),i=new Float32Array(3*this.density);for(let t=0;t<this.density;t++){const s=this.getRandomInt(-this.sceneWidth/2,this.sceneWidth/2),n=this.getRandomInt(-this.sceneHeight/2,this.sceneHeight/2),a=this.getRandomInt(-500,1e3);let h=0,r=0,o=-this.speed;const d=this.degreesToRadians(this.getRandomInt(-45,45));o=Math.floor(-this.speed*Math.cos(d)),r=Math.floor(-this.speed*Math.sin(d));const c=this.degreesToRadians(this.getRandomInt(0,360));h=Math.floor(r*Math.sin(c)),r=Math.floor(r*Math.cos(c)),e[3*t+0]=s,e[3*t+1]=n,e[3*t+2]=a,i[3*t+0]=h,i[3*t+1]=o,i[3*t+2]=r}const n=new s.LoY;n.setAttribute("position",new s.THS(e,3)),n.setAttribute("velocity",new s.THS(i,3));const a=(new s.Tap).load(this.image),h=new s.BH$({size:this.size,map:a,depthTest:!1,transparent:!0});this.particles=new s.ONl(n,h),this.scene.add(this.particles),this.camera.lookAt(this.scene.position),this.renderer=new s.JeP({alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(window.innerWidth,window.innerHeight),this.container.setAttribute("style","position: fixed; z-index: 1000002; top: 0; right: 0; left: 0; pointer-events: none;"),this.container.appendChild(this.renderer.domElement),window.addEventListener("resize",()=>this.onWindowResize()),this.animate(0)}static init(t){new n(t)}getRandomInt(t,e){return Math.floor(Math.random()*(e-t)+t)}degreesToRadians(t){return t*(Math.PI/180)}onWindowResize(){this.camera.aspect=window.innerWidth/window.innerHeight,this.camera.updateProjectionMatrix(),this.renderer.setSize(window.innerWidth,window.innerHeight)}animate(t){requestAnimationFrame(t=>this.animate(t));const e=t-this.lastFrameTime;e>this.fpsInterval&&(this.lastFrameTime=t-e%this.fpsInterval,this.render())}render(){const t=this.particles.geometry.attributes.position.array,e=this.particles.geometry.attributes.velocity.array;for(let i=0;i<this.density;i++){const s=3*i+0,n=3*i+1,a=3*i+2;t[s]>this.sceneWidth/2?t[s]-=this.sceneWidth:t[s]<-this.sceneWidth/2?t[s]+=this.sceneWidth:t[s]+=e[s],t[n]<-this.sceneHeight/2?t[n]+=this.sceneHeight:t[n]+=e[n],(t[a]>1e3||t[a]<-500)&&(e[a]=-e[a]),t[a]+=e[a]}this.particles.geometry.attributes.position.needsUpdate=!0,this.particles.geometry.attributes.velocity.needsUpdate=!0,this.renderer.render(this.scene,this.camera)}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.