最新下载
jQuery超酷动态弹出表单 jQuery超酷动态弹出表单网页特效
24小时阅读排行榜
- 1 javascript拖放功能如何实现_原生drag和drop api怎样使用【教程】
- 2 Golang中频繁创建对象如何优化_Golang对象复用与内存优化
- 3 PHP 中 mktime() 函数参数类型错误的修复指南
- 4 PHP 中 mktime() 函数因参数类型严格校验导致的致命错误详解
- 5 PHP中mktime()函数调用错误的修复方法
- 6 如何在动态生成表单时,通过表单外部按钮(如导航栏按钮)触发提交?
- 7 WordPress 中 admin_notices 通知显示位置异常的解决方案
- 8 WordPress 后台通知(admin_notices)显示错位的解决方案
- 9 Pyomo教程:如何在优化模型中为每个请求动态定义时间窗口并施加能量约束
- 10 如何在 Go 中对结构体切片进行降序排序
- 11 WordPress 中 admin_notices 通知显示错位的解决方案
- 12 WordPress 插件中实现 CAPTCHA 图像生成的正确方法
- 13 如何在 WordPress 中随机显示 20 名订阅用户(含头像)
- 14 Pyomo教程:如何为动态时间窗口内的请求构建条件能量约束
- 15 JavaScript 中从数组构建分层随机三叉树的完整教程
最新教程
-
- Node.js 教程
- 16389 2025-08-28
-
- CSS3 教程
- 1547147 2025-08-27
-
- Rust 教程
- 23488 2025-08-27
-
- Vue 教程
- 25913 2025-08-22
-
- PostgreSQL 教程
- 22415 2025-08-21
-
- Git 教程
- 9352 2025-08-21
html5 canvas海底水草动画特效是一款深海底冒泡的海藻动画场景特效
var canvas, ctx, width, height, stems, bubbles;
stems = [];
bubbles = [];
function Bubble(x, y, radius) {
this.x = x;
this.y = y;
this.radius = radius;
this.vy = -Math.random() * 5;
this.opacity = 0.2 + Math.random() * 0.5;
this.oldY = y;
}
Bubble.prototype.draw = function() {
var strokeColor, fillColor;
strokeColor = 'rgba(255, 255, 255,' + this.opacity + ')';
fillColor = 'rgba(255, 255, 255,' + (this.opacity / 2) + ')';
ctx.save();
ctx.lineWidth = 0.8;
ctx.strokeStyle = strokeColor;
ctx.fillStyle = fillColor;
ctx.beginPath();
ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2, true);
ctx.closePath();
ctx.fill();
ctx.stroke();
ctx.restore();
}
