[HTML] 纯文本查看 复制代码
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>💗 爱你 💗 我亲爱的 YOYO 💗</title>
<style type="text/css">
body {
margin: 0;
overflow: hidden;
background: #000;
color: white;
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
position: relative;
user-select: none; / Prevent text selection /
}
canvas {
position: absolute;
width: 100%;
height: 100%;
z-index: -1;
}
#controls {
position: absolute;
bottom: 50px;
left: 50%;
transform: translateX(-50%);
text-align: center;
z-index: 10;
}
#nameDisplay {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 64px; /* Increased font size */
color: #ea80b0;
z-index: 10;
white-space: nowrap; /* Ensure the text stays in one line */
}
#timeDisplay {
position: absolute;
bottom: 20px;
right: 10px;
font-size: 24px;
color: #ffffff;
}
#developerInfo {
position: absolute;
bottom: 10px;
left: 10px;
font-size: 16px;
color: #999999;
z-index: 10;
}
input[type="text"] {
padding: 10px;
font-size: 18px;
margin-right: 10px;
}
button {
padding: 10px 20px;
font-size: 18px;
cursor: pointer;
}
</style>
</head>
<body>
<canvas id="pinkboard"></canvas>
<canvas id="canvas"></canvas>
<div id="nameDisplay">💗YOYO,爱你哟💗</div>
<div id="timeDisplay">加载中...</div>
<div id="controls">
<label for="loverNameInput">请输入小可爱的名字:</label>
<input type="text" id="loverNameInput" placeholder="小可爱的名字">
<button>更新名字</button>
</div>
<div id="developerInfo">Designed by Nong Wenlong</div>
<script>
var loverName = "💗YOYO,爱你哟💗";
const colors = [
"#eec996", "#8fb7d3", "#b7d4c6", "#c3bedd", "#f1d5e4", "#cae1d3",
"#f3c89d", "#d0b0c3", "#819d53", "#c99294", "#cec884", "#ff8e70",
"#e0a111", "#fffdf6", "#cbd7ac", "#e8c6c0", "#dc9898", "#ecc8ba"
];
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
var ww = window.innerWidth;
var wh = window.innerHeight;
function init() {
requestAnimationFrame(render);
canvas.width = ww;
canvas.height = wh;
}
function Heart(x, y) {
this.x = x;
this.y = y;
this.opacity = Math.random() * 0.5 + 0.5;
this.vel = {
x: (Math.random() - 0.5) * 4,
y: (Math.random() - 0.5) * 4,
};
this.targetScale = Math.random() * 0.15 + 0.02;
this.scale = this.targetScale * Math.random();
}
Heart.prototype.update = function () {
this.x += this.vel.x;
this.y += this.vel.y;
this.scale += (this.targetScale - this.scale) * 0.01;
if (this.x > ww || this.x < 0) {
this.scale = 0;
this.x = Math.random() * ww;
}
if (this.y > wh || this.y < 0) {
this.scale = 0;
this.y = Math.random() * wh;
}
};
Heart.prototype.draw = function () {
ctx.globalAlpha = this.opacity;
ctx.font = `${180 * this.scale}px "微软雅黑"`;
ctx.fillStyle = colors[Math.floor(Math.random() * colors.length)];
ctx.fillText(
loverName,
this.x - 200 * this.scale,
this.y - 100 * this.scale,
400 * this.scale,
200 * this.scale
);
};
var hearts = [];
function createHearts(count) {
for (var i = 0; i < count; i++) {
hearts.push(new Heart(Math.random() * ww, Math.random() * wh));
}
}
function render() {
ctx.clearRect(0, 0, ww, wh);
for (var i = 0; i < hearts.length; i++) {
hearts[zxsq-anti-bbcode-i].update();
hearts[zxsq-anti-bbcode-i].draw();
}
requestAnimationFrame(render);
}
init();
createHearts(100);
window.addEventListener("resize", function () {
ww = window.innerWidth;
wh = window.innerHeight;
canvas.width = ww;
canvas.height = wh;
});
// Function to update the displayed name
function updateLoverName() {
var inputName = document.getElementById('loverNameInput').value.trim();
if (inputName) {
loverName = "💗" + inputName + ",爱你哟💗";
document.getElementById('nameDisplay').innerText = loverName;
} else {
alert("请输入有效的名字!");
}
}
// Update the time display every second
function updateTimeDisplay() {
var now = new Date();
var hours = String(now.getHours()).padStart(2, '0');
var minutes = String(now.getMinutes()).padStart(2, '0');
var seconds = String(now.getSeconds()).padStart(2, '0');
document.getElementById('timeDisplay').innerText = hours + ":" + minutes + ":" + seconds;
}
// Initial call to set the time immediately
updateTimeDisplay();
// Set interval to update time every second
setInterval(updateTimeDisplay, 1000);
// Disable right-click context menu
document.addEventListener('contextmenu', function(e) {
e.preventDefault();
});
// Disable copy and paste
document.addEventListener('copy', function(e) {
e.preventDefault();
});
document.addEventListener('paste', function(e) {
e.preventDefault();
});
// Disable dragging of elements
document.addEventListener('dragstart', function(e) {
e.preventDefault();
});
</script>
</body>
</html>
</head>
<body>
<canvas id="pinkboard"></canvas>
<canvas id="canvas"></canvas>
<div id="nameDisplay">💗YOYO,爱你哟💗</div>
<div id="timeDisplay">加载中...</div>
<div id="controls">
<label for="loverNameInput">请输入小可爱的名字:</label>
<input type="text" id="loverNameInput" placeholder="小可爱的名字">
<button>更新名字</button>
</div>
<div id="developerInfo">Designed by Nong Wenlong</div>
<script>
var loverName = "💗YOYO,爱你哟💗";
const colors = [
"#eec996", "#8fb7d3", "#b7d4c6", "#c3bedd", "#f1d5e4", "#cae1d3",
"#f3c89d", "#d0b0c3", "#819d53", "#c99294", "#cec884", "#ff8e70",
"#e0a111", "#fffdf6", "#cbd7ac", "#e8c6c0", "#dc9898", "#ecc8ba"
];
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
var ww = window.innerWidth;
var wh = window.innerHeight;
function init() {
requestAnimationFrame(render);
canvas.width = ww;
canvas.height = wh;
}
function Heart(x, y) {
this.x = x;
this.y = y;
this.opacity = Math.random() * 0.5 + 0.5;
this.vel = {
x: (Math.random() - 0.5) * 4,
y: (Math.random() - 0.5) * 4,
};
this.targetScale = Math.random() * 0.15 + 0.02;
this.scale = this.targetScale * Math.random();
}
Heart.prototype.update = function () {
this.x += this.vel.x;
this.y += this.vel.y;
this.scale += (this.targetScale - this.scale) * 0.01;
if (this.x > ww || this.x < 0) {
this.scale = 0;
this.x = Math.random() * ww;
}
if (this.y > wh || this.y < 0) {
this.scale = 0;
this.y = Math.random() * wh;
}
};
Heart.prototype.draw = function () {
ctx.globalAlpha = this.opacity;
ctx.font = `${180 * this.scale}px "微软雅黑"`;
ctx.fillStyle = colors[Math.floor(Math.random() * colors.length)];
ctx.fillText(
loverName,
this.x - 200 * this.scale,
this.y - 100 * this.scale,
400 * this.scale,
200 * this.scale
);
};
var hearts = [];
function createHearts(count) {
for (var i = 0; i < count; i++) {
hearts.push(new Heart(Math.random() * ww, Math.random() * wh));
}
}
function render() {
ctx.clearRect(0, 0, ww, wh);
for (var i = 0; i < hearts.length; i++) {
hearts[i].update();
hearts[i].draw();
}
requestAnimationFrame(render);
}
init();
createHearts(100);
window.addEventListener("resize", function () {
ww = window.innerWidth;
wh = window.innerHeight;
canvas.width = ww;
canvas.height = wh;
});
// Function to update the displayed name
function updateLoverName() {
var inputName = document.getElementById('loverNameInput').value.trim();
if (inputName) {
loverName = "💗" + inputName + ",爱你哟💗";
document.getElementById('nameDisplay').innerText = loverName;
} else {
alert("请输入有效的名字!");
}
}
// Update the time display every second
function updateTimeDisplay() {
var now = new Date();
var hours = String(now.getHours()).padStart(2, '0');
var minutes = String(now.getMinutes()).padStart(2, '0');
var seconds = String(now.getSeconds()).padStart(2, '0');
document.getElementById('timeDisplay').innerText = hours + ":" + minutes + ":" + seconds;
}
// Initial call to set the time immediately
updateTimeDisplay();
// Set interval to update time every second
setInterval(updateTimeDisplay, 1000);
// Disable right-click context menu
document.addEventListener('contextmenu', function(e) {
e.preventDefault();
});
// Disable copy and paste
document.addEventListener('copy', function(e) {
e.preventDefault();
});
document.addEventListener('paste', function(e) {
e.preventDefault();
});
// Disable dragging of elements
document.addEventListener('dragstart', function(e) {
e.preventDefault();
});
</script>
</body>
</html>