这是程序员表白系列中的100款网站表白之一,旨在让任何人都能使用并创建自己的表白网站给心爱的人看。 此波共有100个表白网站,可以任意修改和使用,很多人会希望向心爱的男孩女孩告白,生性腼腆的人即使那个TA站在眼前都不敢向前表白。说不出口的话就用短视频告诉TA吧~制作一个表白网页告诉TA你的心意,演示如下。
❤ 【作者主页——🔥获取更多优质源码】
❤ 【学习资料/简历模板/面试资料/ 网站设计与制作】
❤ 【web前端期末大作业——🔥🔥毕设项目精品实战案例】
文章目录
- 一、网页介绍
- 一、网页效果
- 二、代码展示
- 1.HTML代码
- 2.js代码
- 三、精彩专栏
一、网页介绍
1 网页简介:基于 HTML+CSS+JavaScript 制作七夕情人节表白网页、生日祝福、七夕告白、 求婚、浪漫爱情3D相册、炫酷代码
,快来制作一款高端的表白网页送(他/她)浪漫的告白,制作修改简单,可自行更换背景音乐,文字和图片即可使用
2.网页编辑:任意HTML编辑软件(如:Dreamweaver、HBuilder、Vscode 、Sublime 、Webstorm、Text 、Notepad++ 等任意html编辑软件进行运行及修改编辑等操作)。
一、网页效果
二、代码展示
1.HTML代码
代码如下(示例):以下仅展示部分代码供参考~
<!-- * @Author: your name * @Date: 2021-05-24 14:22:07 * @LastEditTime: 2021-05-24 14:22:40 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: \canvas彩色酷炫的空间背景动画特效\index.html --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Space scroller - No WebGL</title> </head> <body> <!-- html5基于canvas绘制彩色酷炫的空间粒子移动背景动画特效。 --> <script src="js/gameCanvas-3.0.js"></script> <script src="js/index.js"></script> </body> </html>
复制
2.js代码
var gc = new GameCanvas(); var stars = []; var circles = []; var lineStars = []; for (var i = 0; i < 1000; i++) { stars.push({x: Math.random() * width, y: Math.random() * height, radius: Math.random() * 2}); } for (var i = 0; i < 100; i++) { lineStars.push({x: Math.random() * width, y: Math.random() * height, lx: 0, ly: 0}); } for (var i = 0; i < 250; i++) { circles.push({x: Math.random() * width, y: Math.random() * height, radius: 300, color: "rgba(255, 0, 0, 0.01)"}); circles.push({x: Math.random() * width, y: Math.random() * height, radius: 300, color: "rgba(0, 0, 255, 0.01)"}); if (!(i % 3)) circles.push({x: Math.random() * width, y: Math.random() * height, radius: 300, color: "rgba(200, 255, 0, 0.01)"}); } for (var i = 0; i < 100; i++) { circles.push({x: random_normal() / 6 * width + width / 2, y: random_normal() / 6 * height + height / 2, radius: 200, color: "rgba(255, 255, 255, 0.01)"}); } var canvas2 = document.createElement("canvas"); canvas2.width = width; canvas2.height = height; var ctx2 = canvas2.getContext("2d"); ctx2.fillStyle = "rgb(20, 20, 20)"; ctx2.fillRect(0, 0, canvas2.width, canvas2.height); ctx2.globalCompositeOperation = "lighter"; for (var i = 0; i < circles.length; i++) { var c = circles[i]; ctx2.beginPath(); ctx2.arc(c.x, c.y, c.radius, 0, Math.PI * 2); ctx2.fillStyle = c.color; ctx2.fill(); } var img = new Image(); img.src = canvas2.toDataURL(); function loop() { background("rgb(20, 20, 20)"); gc.ctx.drawImage(img, 0, 0); for (var i = 0; i < stars.length; i++) { var s = stars[i]; rect(s.x, s.y, s.radius * 1.5, s.radius * 1.5, "white"); s.x += s.radius / 2; if (s.x > width) s.x = 0; if (s.x < 0) s.x = width; if (s.y > height) s.y = 0; if (s.y < 0) s.y = height; } for (var i = 0; i < lineStars.length; i++) { var s = lineStars[i]; s.x += 25; line(s.x, s.y, s.lx, s.ly, "white", "white"); if (s.x > width) s.x = 0; if (s.x < 0) s.x = width; if (s.y > height) s.y = 0; if (s.y < 0) s.y = height; s.lx = s.x; s.ly = s.y; } /*var x = width / 2; var y = height / 2; var radius = 200; var grd = gc.ctx.createRadialGradient(x, y, radius, x, y, radius + 20); grd.addColorStop(0, "white"); grd.addColorStop(1, "rgba(255, 255, 255, 0)"); circle(x, y, radius + 20, grd); circle(x, y, radius, "black");*/ } function random_normal() { var u = 0, v = 0; while(u === 0) u = Math.random(); //Converting [0,1) to (0,1) while(v === 0) v = Math.random(); return Math.sqrt( -2.0 * Math.log( u ) ) * Math.cos( 2.0 * Math.PI * v );}
复制
三、精彩专栏
看到这里了就 【点赞,好评,收藏】
三连 支持下吧,你的支持是我创作的动力