js实现canvas圣诞节新年下大雪粒子动画效果代码
代码语言:html
所属分类:粒子
代码描述:js实现canvas圣诞节新年下大雪粒子动画效果代码,雪花比较大比较急。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!doctype html> <html> <head> <meta charset="utf-8"> <title>下雪</title> <style> body { background: url(//repo.bfw.wiki/bfwrepo/image/5fdd387b774b6.png) no-repeat; background-size: cover; display: block; width: 100%; height: 100%; min-height: 100vh; color: #fff; font-family: 'Verdana', sans-serif; overflow:hidden; } h1 { font-size: 46px; text-shadow: 0 4px 10px rgba(0, 0, 0, 0.7); } .mainContainer { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); width: 100%; } .title { text-align: center; } </style> </head> <body> <canvas id="canvas"></canvas> <div class="mainContainer"> <h1 class="title">圣诞节快乐!</h1> </div> <script> var c = document.getElementById('canvas'), $ = c.getContext("2d"), w = c.width = window.innerWidth, h = c.height = window.innerHeight; function makeItSnow() { var snow, arr = [], num = 1500, tsc = 1, sp = 1; sc = 1.3, t = 0, mv = 20, min = 1; for (var i = 0; i < num; ++i) { snow = new Flake(); snow.y = Math.random() * (h + 50); snow.x = Math.random() * w; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0