element-web-synapse01pim.gr.jp

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

3197.js.map (6626B)


      1 {"version":3,"file":"bundles/c63939549511ecf2b427/3197.js","mappings":"i0BA8BO,MAAMA,EAAkC,CAC3CC,SAAU,IACVC,MAAO,IAKI,MAAMC,EAGVC,WAAAA,CAAYC,IAAiCC,EAAAA,EAAAA,GAAA,wBAAAA,EAAAA,EAAAA,GAAA,eAID,OAAIA,EAAAA,EAAAA,GAAA,iBAClB,KAAEA,EAAAA,EAAAA,GAAA,yBACX,IAACA,EAAAA,EAAAA,GAAA,kBAEV,IAAKA,EAAAA,EAAAA,GAAA,aAETC,MAAOC,EAA2BC,EAAU,OACvD,IAAKD,EACD,OAEJE,KAAKC,QAAUH,EAAOI,WAAW,MACjCF,KAAKG,UAAY,GACjB,MAAMC,EAAQJ,KAAKL,QAAQJ,SAC3B,KAAOS,KAAKG,UAAUE,OAASD,GAC3BJ,KAAKG,UAAUG,KAAKN,KAAKO,cAAc,CAAC,EAAeT,EAAOU,MAAOV,EAAOW,SAEhFT,KAAKU,WAAY,EACjBC,sBAAsBX,KAAKY,YACvBb,GACAc,OAAOC,WAAWd,KAAKe,KAAMhB,MAEpCH,EAAAA,EAAAA,GAAA,YAEaC,UACVG,KAAKU,WAAY,KACpBd,EAAAA,EAAAA,GAAA,qBAEuB,CAACoB,EAAoBR,EAAeC,KACxDO,EAASC,EAAIC,KAAKC,SAAWX,EAC7BQ,EAASI,EAAIF,KAAKC,UAAYV,EAC9BO,EAASR,MAAwB,IAAhBU,KAAKC,SACtBH,EAASP,OAA0B,GAAjBO,EAASR,MAAa,EACxCQ,EAASxB,MAAS0B,KAAKC,SAAWnB,KAAKL,QAAQH,MAAQ,EAAK,EAAIQ,KAAKL,QAAQH,MACtEwB,KACVpB,EAAAA,EAAAA,GAAA,kBAEoB,KACjB,GAAKI,KAAKC,SAAYD,KAAKC,QAAQH,OAGnC,GAA8B,IAA1BE,KAAKG,UAAUE,OACfL,KAAKC,QAAQoB,UAAU,EAAG,EAAGrB,KAAKC,QAAQH,OAAOU,MAAOR,KAAKC,QAAQH,OAAOW,YACzE,EACea,KAAKC,MAAQvB,KAAKwB,mBApDrB,KAqDyBxB,KAAKwB,qBAEzCxB,KAAKC,QAAQoB,UAAU,EAAG,EAAGrB,KAAKC,QAAQH,OAAOU,MAAOR,KAAKC,QAAQH,OAAOW,QAC5ET,KAAKwB,kBAAoBF,KAAKC,MAC9BvB,KAAKyB,6BAETd,sBAAsBX,KAAKY,WAC/B,KACHhB,EAAAA,EAAAA,GAAA,iCAEmC,KAChC,IAAKI,KAAKC,UAAYD,KAAKC,QAAQH,OAC/B,OAEJ,MAAMW,EAAST,KAAKC,QAAQH,OAAOW,OACnC,IAAK,MAAMO,KAAYU,EAAAA,EAAAA,IAAe1B,KAAKG,WAAY,CACnDa,EAASI,GAAKJ,EAASxB,MAEvBQ,KAAKC,QAAQ0B,OACb3B,KAAKC,QAAQ2B,YACb5B,KAAKC,QAAQ4B,KAAKb,EAASC,EAAGD,EAASI,EAAGJ,EAASR,MAAOQ,EAASP,QACnET,KAAKC,QAAQ6B,UAAY,UACzB9B,KAAKC,QAAQ8B,OACb/B,KAAKC,QAAQ+B,YACbhC,KAAKC,QAAQgC,UAGb,MAAMC,EAAqB,EAATzB,EAClB,GAAIO,EAASI,EAAIX,EAASyB,EAAW,CACjC,MAAMC,EAAMnC,KAAKG,UAAUiC,QAAQpB,GACnChB,KAAKG,UAAUkC,OAAOF,EAAK,EAC/B,CACJ,IA/EAnC,KAAKL,QAAO2C,EAAAA,EAAA,GAAQhD,GAAmBK,EAC3C,E","sources":["webpack://element-web/./src/effects/rainfall/index.ts"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\nCopyright 2020-2023 The Matrix.org Foundation C.I.C.\nCopyright 2021 Josias Allestad\n\nSPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n */\nimport type ICanvasEffect from \"../ICanvasEffect\";\nimport { arrayFastClone } from \"../../utils/arrays\";\n\nexport type RainfallOptions = {\n    /**\n     * The maximum number of raindrops to render at a given time\n     */\n    maxCount: number;\n    /**\n     * The speed of the raindrops\n     */\n    speed: number;\n};\n\ntype Raindrop = {\n    x: number;\n    y: number;\n    height: number;\n    width: number;\n    speed: number;\n};\n\nexport const DefaultOptions: RainfallOptions = {\n    maxCount: 600,\n    speed: 12,\n};\n\nconst KEY_FRAME_INTERVAL = 15;\n\nexport default class Rainfall implements ICanvasEffect {\n    private readonly options: RainfallOptions;\n\n    public constructor(options: { [key: string]: any }) {\n        this.options = { ...DefaultOptions, ...options };\n    }\n\n    private context: CanvasRenderingContext2D | null = null;\n    private particles: Array<Raindrop> = [];\n    private lastAnimationTime = 0;\n\n    public isRunning = false;\n\n    public start = async (canvas: HTMLCanvasElement, timeout = 3000): Promise<void> => {\n        if (!canvas) {\n            return;\n        }\n        this.context = canvas.getContext(\"2d\");\n        this.particles = [];\n        const count = this.options.maxCount;\n        while (this.particles.length < count) {\n            this.particles.push(this.resetParticle({} as Raindrop, canvas.width, canvas.height));\n        }\n        this.isRunning = true;\n        requestAnimationFrame(this.renderLoop);\n        if (timeout) {\n            window.setTimeout(this.stop, timeout);\n        }\n    };\n\n    public stop = async (): Promise<void> => {\n        this.isRunning = false;\n    };\n\n    private resetParticle = (particle: Raindrop, width: number, height: number): Raindrop => {\n        particle.x = Math.random() * width;\n        particle.y = Math.random() * -height;\n        particle.width = Math.random() * 1.5;\n        particle.height = particle.width * 15 + 4;\n        particle.speed = (Math.random() * this.options.speed * 4) / 5 + this.options.speed;\n        return particle;\n    };\n\n    private renderLoop = (): void => {\n        if (!this.context || !this.context.canvas) {\n            return;\n        }\n        if (this.particles.length === 0) {\n            this.context.clearRect(0, 0, this.context.canvas.width, this.context.canvas.height);\n        } else {\n            const timeDelta = Date.now() - this.lastAnimationTime;\n            if (timeDelta >= KEY_FRAME_INTERVAL || !this.lastAnimationTime) {\n                // Clear the screen first\n                this.context.clearRect(0, 0, this.context.canvas.width, this.context.canvas.height);\n                this.lastAnimationTime = Date.now();\n                this.animateAndRenderRaindrops();\n            }\n            requestAnimationFrame(this.renderLoop);\n        }\n    };\n\n    private animateAndRenderRaindrops = (): void => {\n        if (!this.context || !this.context.canvas) {\n            return;\n        }\n        const height = this.context.canvas.height;\n        for (const particle of arrayFastClone(this.particles)) {\n            particle.y += particle.speed;\n\n            this.context.save();\n            this.context.beginPath();\n            this.context.rect(particle.x, particle.y, particle.width, particle.height);\n            this.context.fillStyle = \"#5dadec\"; // light blue\n            this.context.fill();\n            this.context.closePath();\n            this.context.restore();\n\n            // Remove dead raindrops\n            const maxBounds = height * 2;\n            if (particle.y > height + maxBounds) {\n                const idx = this.particles.indexOf(particle);\n                this.particles.splice(idx, 1);\n            }\n        }\n    };\n}\n"],"names":["DefaultOptions","maxCount","speed","Rainfall","constructor","options","_defineProperty","async","canvas","timeout","this","context","getContext","particles","count","length","push","resetParticle","width","height","isRunning","requestAnimationFrame","renderLoop","window","setTimeout","stop","particle","x","Math","random","y","clearRect","Date","now","lastAnimationTime","animateAndRenderRaindrops","arrayFastClone","save","beginPath","rect","fillStyle","fill","closePath","restore","maxBounds","idx","indexOf","splice","_objectSpread"],"ignoreList":[],"sourceRoot":""}