Update sakura.js

pull/111/head
Who? 2025-03-03 10:33:02 +07:00 committed by GitHub
parent 1d46cd5414
commit 850dfde53a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 115 additions and 117 deletions

View File

@ -3,11 +3,9 @@ const Sakura = function(t, e) {
if (void 0 === t) throw new Error("No selector present. Define an element."); if (void 0 === t) throw new Error("No selector present. Define an element.");
this.el = document.querySelector(t); this.el = document.querySelector(t);
var i, n; var i, n;
function a(t) { function a(t) {
return t[Math.floor(Math.random() * t.length)]; return t[Math.floor(Math.random() * t.length)];
} }
function s(t, e) { function s(t, e) {
return Math.floor(Math.random() * (e - t + 1)) + t; return Math.floor(Math.random() * (e - t + 1)) + t;
} }
@ -18,11 +16,13 @@ const Sakura = function(t, e) {
maxSize: 14, maxSize: 14,
minSize: 10, minSize: 10,
delay: 300, delay: 300,
colors: [{ colors: [
{
gradientColorStart: "rgba(255, 183, 197, 0.9)", gradientColorStart: "rgba(255, 183, 197, 0.9)",
gradientColorEnd: "rgba(255, 197, 208, 0.9)", gradientColorEnd: "rgba(255, 197, 208, 0.9)",
gradientColorDegree: 120, gradientColorDegree: 120,
}, ], },
],
}), }),
(n = e), (n = e),
Object.keys(i).forEach((t) => { Object.keys(i).forEach((t) => {
@ -31,14 +31,12 @@ const Sakura = function(t, e) {
i)), i)),
(this.el.style.overflowX = "hidden"); (this.el.style.overflowX = "hidden");
const o = ["webkit", "moz", "MS", "o", ""]; const o = ["webkit", "moz", "MS", "o", ""];
function r(t, e, i) { function r(t, e, i) {
for (let n = 0; n < o.length; n += 1) { for (let n = 0; n < o.length; n += 1) {
let a = e; let a = e;
o[n] || (a = e.toLowerCase()), t.addEventListener(o[n] + a, i, !1); o[n] || (a = e.toLowerCase()), t.addEventListener(o[n] + a, i, !1);
} }
} }
function l(t) { function l(t) {
const e = t.getBoundingClientRect(); const e = t.getBoundingClientRect();
return ( return (