最新下载
24小时阅读排行榜
- 1 php怎么调试接口接口文档_php接口文档编写与接口调试对应方法
- 2 系统重装后驱动安装顺序指南
- 3 Golang如何构建简单的库存统计项目
- 4 双系统安装教程_Windows+Linux共存配置
- 5 Python入门如何安装第三方库_Python入门包管理的必备技能
- 6 如何在mysql中设计商品评价系统
- 7 三星S26系列传闻大乱斗:相机升级成谜 电池暗藏惊喜
- 8 圆通快递查询入口首页 圆通物流包裹运输进度查询
- 9 百度AI官方主页直达地址_百度AI官网链接入口最新版本
- 10 夸克A眼镜怎么开机_夸克A眼镜开机步骤与注意事项详细说明
- 11 jquery中如何使用val()方法取值?
- 12 如何清理vivo云服务空间 怎么清理vivo云服务的空间
- 13 如何编辑网页HTML中的网格系统_如何编辑网页HTML中使用Bootstrap网格系统的方法
- 14 笔记本电脑电池保养秘籍
- 15 如何在Linux服务器上设置一个自动抓取RSS的Cron Job_在Linux服务器设置自动抓取RSS的Cron Job
最新教程
-
- Node.js 教程
- 7785 2025-08-28
-
- CSS3 教程
- 1080219 2025-08-27
-
- Rust 教程
- 12299 2025-08-27
-
- Vue 教程
- 14491 2025-08-22
-
- PostgreSQL 教程
- 11161 2025-08-21
-
- Git 教程
- 5249 2025-08-21
代码片段:
class Bubble {
constructor(target, i) {
this.bubble = document.createElement("div");
this.bubble.classList.add("bubble");
this.x = Math.floor(Math.random() * innerWidth);
this.y = Math.floor(Math.random() * innerHeight);
this.scale = Math.random();
this.pos = Math.round(Math.random());
this.bubble.style.top = `${this.y}px`;
this.bubble.style.left = `${this.x}px`;
this.bubble.style.transform = `translateZ(${
this.pos ? "" : "-"
}${this.scale.toFixed(2) * 1000}px)`;
setTimeout(() => {
target.appendChild(this.bubble);
}, i * 50);
setTimeout(floatOn.bind(null, { el: this.bubble, x: this.x }), i * 50);
}
}

