js实现canvas蒲公英漫天飞舞东动画效果代码
代码语言:html
所属分类:粒子
代码描述:js实现canvas蒲公英漫天飞舞东动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
margin: 0;
overflow: hidden;
}
</style>
</head>
<body>
<!-- #CodePenChallenge: Lightness -->
<canvas width="998" height="722" style="background: linear-gradient(rgb(0, 33, 114), rgb(71, 156, 213));"></canvas>
<script>
var canvas = document.querySelector("canvas");
canvas.style.background = "linear-gradient( to bottom, #002172, #479CD5)";
const randomInt = (min, max) => Math.floor(Math.random() * (max - min) + min);
// get canvas
var _w, _h;
function refreshSize() {
_w = canvas.width = innerWidth;
_h = canvas.height = innerHeight;
}
refreshSize();
// set width and height to canvas
var c = canvas.getContext("2d");
// get context now you can draw from here
class Flower {
constructor(x, y, radius) {
this.x = x;
this.y = y;
this.radius = radius;
this.dx = 0.8 + Math.........完整代码请登录后点击上方下载按钮下载查看
网友评论0