PageSourceSearch

https://infotronica.es/wp-content/plugins/nextbricks/elements/js/next_meteors.min.js?ver=2.3.5

js infotronica.es collected 2026-09-24 15:02:07 UTC 4,326 bytes, 60 lines download raw bytes

1function next_meteors(){class Meteor{constructor(options){const that=this
2    this.canvas=options.element
3    this.easing=options.easing
4    this.options=options
5    this.context=this.canvas.getContext('2d')
6    this.canvas.height=this.canvas.offsetHeight*window.devicePixelRatio
7    this.canvas.width=this.canvas.offsetWidth*window.devicePixelRatio
8    this.meteorWidth=that.options.width
9    this.meteorSpeed=gsap.utils.mapRange(4,12,6,12,that.meteorWidth)
10    this.meteorLength=gsap.utils.mapRange(4,12,50,80,that.meteorWidth)
11    that.gradient=that.context.createLinearGradient(that.canvas.width*0.5,that.canvas.height*0.5,that.canvas.width*0.5,0)
12    this.hue=options.hue
13    this.saturation=options.saturation
14    that.gradient.addColorStop(0,`hsl(${this.hue}, ${this.saturation}%, 100%)`)
15    that.gradient.addColorStop(0.025,`hsl(${this.hue}, ${this.saturation}%, 70%)`)
16    that.gradient.addColorStop(0.15,`hsl(${this.hue}, ${this.saturation}%, 40%)`)
17    that.gradient.addColorStop(0.55,`hsl(${this.hue}, ${this.saturation}%, 20%)`)
18    that.gradient.addColorStop(1,'transparent')
19    this.particles=that.genParticles(gsap.utils.random(50,100,1))
20    this.setParticlesMotion()
21    gsap.ticker.add(this.draw.bind(that))}
22    genParticles(amount){const that=this
23    const particles=[]
24    for(let p=0;p<amount;p++){const particle={
25        size:gsap.utils.random(1,that.options.width*1.25,1)*window.devicePixelRatio,
26    }
27    particles.push(particle)}
28    return particles.slice(0, window.innerWidth < 768 ? amount/2 : amount)}
29    draw(){const that=this
30    that.context.clearRect(0,0,that.canvas.width,that.canvas.height)
31    that.context.shadowBlur=5*window.devicePixelRatio
32    that.context.shadowColor=`hsl(${this.hue}, ${this.saturation}%, 40%)`
33    const visibleParticles = that.particles.filter(p=>!p.dead && p.size > 0.5)
34    for(const particle of visibleParticles){
35        that.context.beginPath()
36        that.context.fillStyle=that.gradient
37        that.context.arc(particle.x,particle.y,particle.size/2,0,2*Math.PI)
38        that.context.fill()
39    }
40    that.context.beginPath()
41    const radius=(that.meteorWidth/2)*window.devicePixelRatio
42    that.context.arc(that.canvas.width*0.5,that.canvas.height*0.5-radius,radius,0,1*Math.PI)
43    that.context.fill()
44    that.context.fillStyle=that.gradient
45    that.context.moveTo(that.canvas.width*0.5-radius,that.canvas.height*0.5-radius)
46    that.context.lineTo(that.canvas.width*0.5,that.canvas.height*0.5-that.meteorLength*window.devicePixelRatio)
47    that.context.lineTo(that.canvas.width*0.5+radius,that.canvas.height*0.5-radius)
48    that.context.fill()}
49    setParticlesMotion(){const that=this
50    for(const particle of that.particles){particle.x=that.canvas.width*0.5
51    particle.y=that.canvas.height*0.5
52    particle.speed=gsap.utils.mapRange(4,12,2,1,that.meteorWidth)
53    particle.dead=!1
54    if(particle.size===0)
55    particle.size=gsap.utils.random(1,that.options.width*1.25,1)*window.devicePixelRatio
56    if(particle.tl)particle.tl.kill()
57    particle.tl=gsap.timeline().to(particle,{x:()=>gsap.utils.random(that.canvas.width*0.5-that.meteorWidth*2.5,that.canvas.width*0.5+that.meteorWidth*2.5,1),y:()=>gsap.utils.random(0,0,1),size:0,repeat:-1,ease:that.easing,repeatDelay:Math.random(),delay:particle.speed*-1,duration:particle.speed,})}}}
58    var isBricks=window.location.href.includes("brickspreview");document.querySelectorAll(".next-meteors").forEach((meteors)=>{if(isBricks&&meteors.dataset.disableBuilder==="1")return;function createMeteor(meteor){var meteorWidth=meteor.getAttribute("data-width");var hue=meteor.getAttribute("data-hue");var saturation=meteor.getAttribute("data-saturation");new Meteor({element:meteor,width:parseFloat(meteorWidth),hue:parseFloat(hue),saturation:parseFloat(saturation)})}
59    if(isBricks){const observer=new MutationObserver((mutations)=>{mutations.forEach((mutation)=>{if(mutation.type==='childList'){mutation.addedNodes.forEach((node)=>{if(node.nodeType===Node.ELEMENT_NODE&&node.classList.contains('next-meteors__meteor')){createMeteor(node)}})}})});const config={childList:!0,subtree:!0};observer.observe(meteors,config)}else{meteors.querySelectorAll(".next-meteors__meteor").forEach(createMeteor)}})}
60    document.addEventListener("DOMContentLoaded",function(t){bricksIsFrontend&&next_meteors()})

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.