时间:2023-07-25 02:42:02 | 来源:网站运营
时间:2023-07-25 02:42:02 来源:网站运营
html+css+javascript生日快乐烟花 ❤520/表白/七夕情人节/求婚❤专用(自定义文字):# html+css+javascript生日快乐烟花 ❤520/表白/七夕情人节/求婚❤专用(自定义文字)(HTML5+CSS3+JS)<!DOCTYPE html><html> <head> <meta charset="UTF-8" /> <title></title> </head> <style type="text/css"> body, html { margin: 0; width: 100%; overflow: hidden; background: #000000; } canvas { position: absolute; width: 100%; } .control button:focus, .control button:hover { background: #222; } </style> <script src="js/jquery.min.js" type="text/javascript" charset="utf-8" ></script> <body> <div class="control" style="position: absolute"></div> </body> <script type="text/javascript"> var can = document.createElement("canvas"); document.body.appendChild(can); var ctx = can.getContext("2d"); var Fireworks = function () { var self = this; var rand = function (rMi, rMa) { return ~~(Math.random() * (rMa - rMi + 1) + rMi); }; var hitTest = function (x1, y1, w1, h1, x2, y2, w2, h2) { return !(x1 + w1 < x2 || x2 + w2 < x1 || y1 + h1 < y2 || y2 + h2 < y1); }; self.updateParticles = function () { var i = self.particles.length; while (i--) { var p = self.particles[i]; var radians = (p.angle * Math.PI) / 180; var vx = Math.cos(radians) * p.speed; var vy = Math.sin(radians) * p.speed; p.speed *= p.friction; p.coordLast[2].x = p.coordLast[1].x; p.coordLast[2].y = p.coordLast[1].y; p.coordLast[1].x = p.coordLast[0].x; p.coordLast[1].y = p.coordLast[0].y; p.coordLast[0].x = p.x; p.coordLast[0].y = p.y; p.x += vx; p.y += vy; p.y += p.gravity; p.angle += p.wind; p.alpha -= p.decay; if ( !hitTest( 0, 0, self.cw, self.ch, p.x - p.radius, p.y - p.radius, p.radius * 2, p.radius * 2 ) || p.alpha < 0.05 ) { self.particles.splice(i, 1); } } }; function draw(obj) { ctx.beginPath(); ctx.arc(obj.target.x, obj.target.y, obj.radius, 0, 2 * Math.PI); ctx.fillStyle = obj.color; ctx.fill(); } changeText("❤宝贝生日快乐!"); var t = 0; var id; var fworks = new Fireworks(); </script></html>
关键词:专用,文字,定义,七夕,生日,快乐,求婚,烟花