canvas气泡粒子发射散开动画效果代码
代码语言:html
所属分类:粒子
代码描述:canvas气泡粒子发射散开动画效果代码适合浏览器端大文件上传。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
margin: 0;
overflow: hidden;
}
</style>
</head>
<body>
<script >
var Bubbles = (function () {
function Bubbles() {
this.canvas = document.createElement('canvas');
this.ctx = this.canvas.getContext('2d');
this.particles = [];
this.counter = 0;
}
Bubbles.prototype.init = function () {
this.createElement();
this.loop();
};
Bubbles.prototype.createElement = function () {
var scale = 1;
this.canvas.width = window.innerWidth;
this.canvas.height = window.innerHeight;
this.canvas.style.background = 'rgb(56, 115, 152)';
this.canvas.style.width = '100%';
this.ctx.transform(scale, 0, 0, -scale, this.canvas.width / 2, this.canvas.height / 2);
.........完整代码请登录后点击上方下载按钮下载查看
网友评论0