element-web-synapse01pim.gr.jp

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

5918.js.map (7964B)


      1 {"version":3,"file":"bundles/12c8185ea2689492c07b/5918.js","mappings":"22BAmCO,MAAMA,EAAkC,CAC3CC,SAAU,IACVC,QAAS,IACTC,SAAU,GAKC,MAAMC,EAGVC,WAAAA,CAAYC,IAAmCC,EAAAA,EAAAA,GAAAC,KAAA,mBAAAD,EAAAA,EAAAA,GAAAC,KAAA,UAIH,OAAID,EAAAA,EAAAA,GAAAC,KAAA,YACjB,KAAED,EAAAA,EAAAA,GAAAC,KAAA,oBACZ,IAACD,EAAAA,EAAAA,GAAAC,KAAA,aAEV,IAAKD,EAAAA,EAAAA,GAAAC,KAAA,QAETC,MAAOC,EAA2BC,EAAU,OACvD,IAAKD,EACD,OAEJF,KAAKI,QAAUF,EAAOG,WAAW,MACjCL,KAAKM,UAAY,GACjB,MAAMC,EAAQP,KAAKF,QAAQL,SAC3B,KAAOO,KAAKM,UAAUE,OAASD,GAC3BP,KAAKM,UAAUG,KAAKT,KAAKU,cAAc,CAAC,EAAgBR,EAAOS,MAAOT,EAAOU,SAEjFZ,KAAKa,WAAY,EACjBC,sBAAsBd,KAAKe,YACvBZ,GACAa,OAAOC,WAAWjB,KAAKkB,KAAMf,MAEpCJ,EAAAA,EAAAA,GAAAC,KAAA,OAEaC,UACVD,KAAKa,WAAY,KACpBd,EAAAA,EAAAA,GAAAC,KAAA,gBAEuB,CAACmB,EAAqBR,EAAeC,KACzDO,EAASC,EAAIC,KAAKC,SAAWX,EAC7BQ,EAASI,EAAIF,KAAKC,UAAYV,EAC9BO,EAASK,KAAOL,EAASC,EACzBD,EAASM,SAA2B,EAAhBJ,KAAKC,SAAe,EACxCH,EAASO,aAAeL,KAAKC,SAAWtB,KAAKF,QAAQH,SAAW,IAChEwB,EAASzB,QAAUM,KAAKF,QAAQJ,QAA0B,EAAhB2B,KAAKC,SAAe,EACvDH,KACVpB,EAAAA,EAAAA,GAAAC,KA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AQ7B,GACnCnB,KAAKM,UAAU2C,OAAOF,EAAK,EAC/B,CACJ,CACJ","sources":["webpack://element-web/./src/effects/snowfall/index.ts"],"sourcesContent":["/*\nCopyright 2024 New Vector Ltd.\nCopyright 2020-2023 The Matrix.org Foundation C.I.C.\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*/\n\nimport type ICanvasEffect from \"../ICanvasEffect\";\nimport { arrayFastClone } from \"../../utils/arrays\";\n\ntype SnowfallOptions = {\n    /**\n     * The maximum number of snowflakes to render at a given time\n     */\n    maxCount: number;\n    /**\n     * The amount of gravity to apply to the snowflakes\n     */\n    gravity: number;\n    /**\n     * The amount of drift (horizontal sway) to apply to the snowflakes. Each snowflake varies.\n     */\n    maxDrift: number;\n};\n\ntype Snowflake = {\n    x: number;\n    y: number;\n    xCol: number;\n    diameter: number;\n    maximumDrift: number;\n    gravity: number;\n};\n\nexport const DefaultOptions: SnowfallOptions = {\n    maxCount: 200,\n    gravity: 0.05,\n    maxDrift: 5,\n};\n\nconst KEY_FRAME_INTERVAL = 15; // 15ms, roughly\n\nexport default class Snowfall implements ICanvasEffect {\n    private readonly options: SnowfallOptions;\n\n    public constructor(options: Partial<SnowfallOptions>) {\n        this.options = { ...DefaultOptions, ...options };\n    }\n\n    private context: CanvasRenderingContext2D | null = null;\n    private particles: Array<Snowflake> = [];\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 Snowflake, 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: Snowflake, width: number, height: number): Snowflake => {\n        particle.x = Math.random() * width;\n        particle.y = Math.random() * -height;\n        particle.xCol = particle.x;\n        particle.diameter = Math.random() * 7 + 4;\n        particle.maximumDrift = Math.random() * this.options.maxDrift + 3.5;\n        particle.gravity = this.options.gravity + Math.random() * 6 + 4;\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\n                this.lastAnimationTime = Date.now();\n                this.animateAndRenderSnowflakes();\n            }\n            requestAnimationFrame(this.renderLoop);\n        }\n    };\n\n    private animateAndRenderSnowflakes(): 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.gravity;\n\n            // We treat the drift as a sine function to have a more fluid-like movement instead\n            // of a pong-like movement off walls of the X column. This means that for\n            // $x=A\\sin(\\frac{2\\pi}{P}y)$ we use the `maximumDrift` as the amplitude (A) and a\n            // large multiplier to create a very long waveform through P.\n            const peakDistance = 75 * particle.maximumDrift;\n            const PI2 = Math.PI * 2;\n            particle.x = particle.maximumDrift * Math.sin((PI2 / peakDistance) * particle.y);\n            particle.x += particle.xCol; // bring the particle to the right place\n\n            const radius = particle.diameter / 2;\n            this.context.save();\n            this.context.beginPath();\n            this.context.ellipse(particle.x, particle.y, radius, radius, 0, 0, 360);\n            this.context.fillStyle = \"#eaeaea\"; // grey so it shows up on the light theme\n            this.context.fill();\n            this.context.closePath();\n            this.context.restore();\n\n            // Remove any dead snowflakes\n            const maxBounds = radius * 4; // make sure it's *really* off screen\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","gravity","maxDrift","Snowfall","constructor","options","_defineProperty","this","async","canvas","timeout","context","getContext","particles","count","length","push","resetParticle","width","height","isRunning","requestAnimationFrame","renderLoop","window","setTimeout","stop","particle","x","Math","random","y","xCol","diameter","maximumDrift","clearRect","Date","now","lastAnimationTime","animateAndRenderSnowflakes","_objectSpread","arrayFastClone","peakDistance","PI2","PI","sin","radius","save","beginPath","ellipse","fillStyle","fill","closePath","restore","maxBounds","idx","indexOf","splice"],"sourceRoot":""}