谁说程序员不懂浪漫,满屏跳动的心形图案送给你,先看效果:
JavaScript代码如下:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body style="background-color: white">
<canvas id='cavs' style='position:fixed; z-index:-1;'></canvas>
</body>
</html>
<script type="text/javascript">
var canvas = document.getElementById("cavs");
const WIDTH = window.innerWidth;
const HEIGHT = window.innerHeight;
canvas.setAttribute("width", WIDTH);
canvas.setAttribute("height", HEIGHT);
var context = canvas.getContext("2d");
var start =
{
loves: [],
DURATION: 30,
begin: function()
{
this.createLove();
},
createLove: function()
{
for (var i = 0<