更多>
最新下载
24小时阅读排行榜
- 1 systemd-oomd 杀进程时优先级不生效或杀错的配置经验
- 2 JavaScript 登录验证循环逻辑详解:正确实现三次尝试限制与用户输入更新
- 3 numpy 如何在不复制数据的情况下修改数组 dtype
- 4 Python 异常在多线程中如何传播?
- 5 C++写入结构体到二进制文件完整教程_高效存储数据技巧
- 6 如何在 React 中混合使用模块化 CSS 类与全局 CSS 类
- 7 Numba函数错误:统一处理1D与2D数组的维度兼容性问题
- 8 Python Web 服务中的幂等性问题
- 9 c++中如何实现广度优先搜索_c++ BFS算法图论遍历方法【汇总】
- 10 如何在网页中正确判断并显示数字的奇偶性
- 11 c++中如何使用std::bind绑定类成员函数_c++回调函数实现技巧【实例】
- 12 C++类型安全进阶:span、expected与variant替代裸指针【现代C++范式】
- 13 Go Template 中正确遍历结构体字段与渲染评论数据的完整指南
- 14 sqlalchemy 如何写递归 CTE 查询树形结构数据
- 15 c++中如何使用optional_c++17 std::optional用法详解【汇总】
更多>
最新教程
-
- Node.js 教程
- 15920 2025-08-28
-
- CSS3 教程
- 1546007 2025-08-27
-
- Rust 教程
- 23109 2025-08-27
-
- Vue 教程
- 25585 2025-08-22
-
- PostgreSQL 教程
- 22084 2025-08-21
-
- Git 教程
- 9090 2025-08-21
html5+canvas绘制抽象液体流动火焰动画特效
canvas.height = window.innerHeight;
if(animate && circle){
t = (t+0.1)%(TWO_PI);
x_new = Math.round(width/2 + width/4* Math.cos(t));
y_new = Math.round(height/2 + height/4* Math.sin(t));
disturbLine(x_new, y_new);
x_old = x_new;
y_old = y_new;
}
vel_step(u_, v_, u_old_, v_old_, visc_, dt_);
dens_step(dens_, dens_old_, u_, v_, diff_, dt_);
draw_texture();
ctx_2.putImageData(plot_rgba, 0, 0);
//ctx.drawImage(canvas_2,0,0,width,height,0,0,canvas.width,canvas.height);
ctx.drawImage(canvas_2,0,0,width,height,window.innerWidth/2-hwidth, window.innerHeight/2-hheight, canvas_2.width, canvas_2.height);
window.requestAnimationFrame(draw);
}
draw();
代码片段:
function draw() {
canvas.width = window.innerWidth;canvas.height = window.innerHeight;
if(animate && circle){
t = (t+0.1)%(TWO_PI);
x_new = Math.round(width/2 + width/4* Math.cos(t));
y_new = Math.round(height/2 + height/4* Math.sin(t));
disturbLine(x_new, y_new);
x_old = x_new;
y_old = y_new;
}
vel_step(u_, v_, u_old_, v_old_, visc_, dt_);
dens_step(dens_, dens_old_, u_, v_, diff_, dt_);
draw_texture();
ctx_2.putImageData(plot_rgba, 0, 0);
//ctx.drawImage(canvas_2,0,0,width,height,0,0,canvas.width,canvas.height);
ctx.drawImage(canvas_2,0,0,width,height,window.innerWidth/2-hwidth, window.innerHeight/2-hheight, canvas_2.width, canvas_2.height);
window.requestAnimationFrame(draw);
}
draw();
本站所有资源都是由网友投搞发布,或转载各大下载站,请自行检测软件的完整性!本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!如有侵权请联系我们删除下架,联系方式:admin@php.cn
