first commit
This commit is contained in:
228
index.html
Normal file
228
index.html
Normal file
@@ -0,0 +1,228 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>520 快乐</title>
|
||||
<link type="text/css" rel="stylesheet" href="./default.css">
|
||||
<script type="text/javascript" src="./jquery.min.js"></script>
|
||||
<script type="text/javascript" src="./functions.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="./love.js" charset="utf-8"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<audio class="music" autoplay="autopaly" loop="loop" src="./like.mp3"></audio>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<div id="wrap">
|
||||
<div id="text">
|
||||
<div id="code">
|
||||
<font color="black" size="3">
|
||||
<span
|
||||
class="say"><span style="font-size: 20px; font-weight: bolder;">遇见你 </span>,像是一场温柔的巧合和缘分。第一次你只是订单列表中的一个名字,当第二次接你上车,却成了心跳加速的开始,之后的每次畅聊,我才知道原来缘分真的会以最奇妙的方式降临。从工作趣事到彼此的学习生活琐碎,从爱好到日常分享,点点滴滴汇聚在一起形成了如今我对你的情感</span><br>
|
||||
<span class="say"></span><br>
|
||||
|
||||
<span
|
||||
class="say">不知不觉间,你如阳光般温暖的笑容、春风般细腻的心思、孩子般纯真的可爱,就像久旱逢甘霖的第一缕晨曦,悄然融化了我的心墙。那些与你共度的时光,无论是车内的谈笑风生,或是偶然交汇的目光,都为我原本按部就班的生活注入了最动人的色彩与活力。</span><br>
|
||||
<span class="say"></span><br>
|
||||
|
||||
|
||||
<span class="say">在<span style="font-size: 28px; font-weight: bolder;"> 520 </span>这个特殊的日子,我鼓起勇气想告诉你: <span style="color: #FF0000; font-weight: bolder;">"我喜欢你,比想象中还要多!"</span>,可理智却在不断提醒我,我们之间横亘着现实的鸿沟:年龄差距、人生轨迹,父辈思想差异..等,我不知道这段对我来说无法遏制喷薄而出的情感是否正确,是否合理,也不知道最终能有何种结果。</span><br>
|
||||
<span class="say"></span><br>
|
||||
|
||||
<span
|
||||
class="say">即便如此,我依然感激和你的相遇相识,你让我明白有些感情即使可能没有结果,也值得被真诚地表达出来,"谢谢你出现在我的世界里,哪怕只是短暂地照亮过”。<span style="color: #FF0000;">"未来的路,无论你走向何方,都愿你被岁月温柔以待"</span> 。我也深信你会遇见更多温暖的人,经历更多美好的故事,而你的优秀与真诚,也必将照亮更灿烂的生命旅程。</span><br>
|
||||
</font>
|
||||
</div>
|
||||
</div>
|
||||
<div id="clock-box">
|
||||
<font color="#666666"><span class="ai" style="color: #FF0000;">潘可爱</span>,我们相识已过去了</font>
|
||||
<div id="clock"></div>
|
||||
</div>
|
||||
<canvas id="canvas"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// 工具函数 - 替代 Jscex.Async.sleep
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
// 工具函数 - 替代动画帧等待
|
||||
function nextFrame() {
|
||||
return new Promise(resolve => requestAnimationFrame(resolve));
|
||||
}
|
||||
|
||||
(async function () {
|
||||
const canvas = $('#canvas');
|
||||
|
||||
if (!canvas[0].getContext) {
|
||||
$("#error").show();
|
||||
return;
|
||||
}
|
||||
|
||||
const width = canvas.width();
|
||||
const height = canvas.height();
|
||||
canvas.attr("width", width);
|
||||
canvas.attr("height", height);
|
||||
|
||||
const opts = {
|
||||
seed: {
|
||||
x: width / 2 - 20,
|
||||
color: "rgb(190, 26, 37)",
|
||||
scale: 2
|
||||
},
|
||||
branch: [
|
||||
[535, 680, 570, 250, 500, 200, 30, 100, [
|
||||
[540, 500, 455, 417, 340, 400, 13, 100, [
|
||||
[450, 435, 434, 430, 394, 395, 2, 40]
|
||||
]],
|
||||
[550, 445, 600, 356, 680, 345, 12, 100, [
|
||||
[578, 400, 648, 409, 661, 426, 3, 80]
|
||||
]],
|
||||
[539, 281, 537, 248, 534, 217, 3, 40],
|
||||
[546, 397, 413, 247, 328, 244, 9, 80, [
|
||||
[427, 286, 383, 253, 371, 205, 2, 40],
|
||||
[498, 345, 435, 315, 395, 330, 4, 60]
|
||||
]],
|
||||
[546, 357, 608, 252, 678, 221, 6, 100, [
|
||||
[590, 293, 646, 277, 648, 271, 2, 80]
|
||||
]]
|
||||
]]
|
||||
],
|
||||
bloom: {
|
||||
num: 700,
|
||||
width: 1080,
|
||||
height: 650,
|
||||
},
|
||||
footer: {
|
||||
width: 1200,
|
||||
height: 5,
|
||||
speed: 5,
|
||||
}
|
||||
};
|
||||
|
||||
const tree = new Tree(canvas[0], width, height, opts);
|
||||
const seed = tree.seed;
|
||||
const foot = tree.footer;
|
||||
let hold = 1;
|
||||
|
||||
// 事件处理函数
|
||||
const handleClick = async (e) => {
|
||||
$(".music")[0].play();
|
||||
const offset = canvas.offset();
|
||||
const x = e.pageX - offset.left;
|
||||
const y = e.pageY - offset.top;
|
||||
|
||||
if (seed.hover(x, y)) {
|
||||
hold = 0;
|
||||
canvas.off("click", handleClick);
|
||||
canvas.off("mousemove", handleMouseMove);
|
||||
canvas.removeClass('hand');
|
||||
}
|
||||
};
|
||||
|
||||
const handleMouseMove = (e) => {
|
||||
const offset = canvas.offset();
|
||||
const x = e.pageX - offset.left;
|
||||
const y = e.pageY - offset.top;
|
||||
canvas.toggleClass('hand', seed.hover(x, y));
|
||||
};
|
||||
|
||||
canvas.on("click", handleClick)
|
||||
.on("mousemove", handleMouseMove);
|
||||
|
||||
// 动画函数
|
||||
async function seedAnimate() {
|
||||
seed.draw();
|
||||
|
||||
// 等待点击
|
||||
while (hold) {
|
||||
await sleep(10);
|
||||
}
|
||||
|
||||
// 种子缩放
|
||||
while (seed.canScale()) {
|
||||
seed.scale(0.95);
|
||||
await sleep(10);
|
||||
}
|
||||
|
||||
// 种子移动
|
||||
while (seed.canMove()) {
|
||||
seed.move(0, 2);
|
||||
foot.draw();
|
||||
await sleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
async function growAnimate() {
|
||||
do {
|
||||
tree.grow();
|
||||
await sleep(10);
|
||||
} while (tree.canGrow());
|
||||
}
|
||||
|
||||
async function flowAnimate() {
|
||||
do {
|
||||
tree.flower(1);
|
||||
await sleep(10);
|
||||
} while (tree.canFlower());
|
||||
}
|
||||
|
||||
async function moveAnimate() {
|
||||
tree.snapshot("p1", 240, 0, 610, 680);
|
||||
|
||||
while (tree.move("p1", 500, 0)) {
|
||||
foot.draw();
|
||||
await sleep(10);
|
||||
}
|
||||
|
||||
foot.draw();
|
||||
tree.snapshot("p2", 500, 0, 610, 680);
|
||||
canvas.parent().css("background", `url(${tree.toDataURL('image/png')})`);
|
||||
}
|
||||
|
||||
async function jumpAnimate() {
|
||||
const ctx = tree.ctx;
|
||||
while (true) {
|
||||
tree.ctx.clearRect(0, 0, width, height);
|
||||
tree.jump();
|
||||
foot.draw();
|
||||
await nextFrame(); // 使用requestAnimationFrame更流畅
|
||||
}
|
||||
}
|
||||
|
||||
async function textAnimate() {
|
||||
const together = new Date(2025, 4, 5, 22, 40, 0); // 月份是0-11
|
||||
|
||||
$("#code").show().typewriter();
|
||||
$("#clock-box").fadeIn(500);
|
||||
|
||||
while (true) {
|
||||
timeElapse(together);
|
||||
await sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
// 主执行流程
|
||||
try {
|
||||
await seedAnimate();
|
||||
await growAnimate();
|
||||
await flowAnimate();
|
||||
await moveAnimate();
|
||||
|
||||
// 并行执行文字动画和跳跃动画
|
||||
await Promise.all([
|
||||
textAnimate(),
|
||||
jumpAnimate()
|
||||
]);
|
||||
} catch (error) {
|
||||
console.error("动画执行出错:", error);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user