console
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>爱心便签动画</title>
<style>
*{margin:0;padding:0;box-sizing:border-box}
body{background:#05070d;overflow:hidden}
.note{
position:absolute;width:110px;height:70px;
display:flex;align-items:center;justify-content:center;
font-size:14px;font-weight:700;padding:6px;
color:#fff;text-align:center;line-height:1.2;
opacity:0;transform:scale(0.4);
animation:popIn 0.3s ease forwards;
}
@keyframes popIn{
0%{opacity:0;transform:scale(0.25) rotate(-10deg)}
60%{opacity:1;transform:scale(1.1) rotate(4deg)}
100%{opacity:1;transform:scale(1) rotate(0deg)}
}
.note-style-1{
background:linear-gradient(135deg,#ff6b9d,#c44569);
border:2px solid #ffd1dc;
border-radius:14px 22px 18px 24px/20px 16px 26px 18px;
box-shadow:0 0 18px rgba(255,105,180,.55),inset 0 0 10px rgba(255,255,255,.15);
}
.note-style-2{
background:linear-gradient(135deg,#f67280,#f8b500);
border:2px solid #ffe66d;
border-radius:22px 16px 26px 18px/18px 24px 14px 22px;
box-shadow:0 0 18px rgba(255,175,64,.5),inset 0 0 10px rgba(255,255,255,.12);
}
.note-style-3{
background:linear-gradient(135deg,#a18cd1,#fbc2eb);
border:2px solid #e0c3fc;
border-radius:18px 24px 16px 22px/22px 18px 24px 16px;
box-shadow:0 0 18px rgba(180,140,220,.5),inset 0 0 10px rgba(255,255,255,.12);
}
.note-style-4{
background:linear-gradient(135deg,#56ccf2,#2f80ed);
border:2px solid #b8f0ff;
border-radius:24px 18px 22px 16px/16px 22px 20px 24px;
box-shadow:0 0 18px rgba(86,204,242,.45),inset 0 0 10px rgba(255,255,255,.12);
}
.note-style-5{
background:linear-gradient(135deg,#43e97b,#38f9d7);
border:2px solid #bfffcf;
border-radius:20px 26px 14px 20px/24px 14px 22px 18px;
box-shadow:0 0 18px rgba(67,233,123,.45),inset 0 0 10px rgba(255,255,255,.12);
}
.particle{
position:absolute;width:2px;height:2px;
background:radial-gradient(circle,#fff6a8 0%,gold 40%,rgba(255,215,0,0)70%);
border-radius:50%;pointer-events:none;
box-shadow:0 0 5px #ffd700,0 0 10px #ffb347;
}
.person{
position:absolute;bottom:-420px;left:50%;
transform:translateX(-50%);opacity:0;
transition:bottom 1.4s cubic-bezier(.2,.8,.2,1),opacity 1.2s ease-out;
filter:drop-shadow(0 0 14px rgba(255,255,255,.45));
}
.person.show{bottom:5%;opacity:1;}
</style>
</head>
<body>
<svg class="person" id="person" width="260" height="380" viewBox="0 0 260 380">
<circle cx="130" cy="55" r="22" fill="none" stroke="#fff" stroke-width="2.5"/>
<line x1="130" y1="77" x2="130" y2="170" stroke="#fff" stroke-width="2.5"/>
<path d="M130 100 Q 95 125 102 155" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round"/>
<!-- 白色手臂完整延伸到最右端,和你截图完全一致 -->
<line x1="130" y1="100" x2="245" y2="62" stroke="#fff" stroke-width="2.5" stroke-linecap="round"/>
<line x1="130" y1="170" x2="95" y2="270" stroke="#fff" stroke-width="2.5"/>
<line x1="130" y1="170" x2="165" y2="270" stroke="#fff" stroke-width="2.5"/>
<!-- 在手臂端点叠加红色玫瑰花,只有一小截绿色花梗,不覆盖白色手臂 -->
<g transform="translate(245,62)">
<line x1="0" y1="0" x2="18" y2="-6" stroke="#2ecc71" stroke-width="2.5" stroke-linecap="round"/>
<!-- 玫瑰花花瓣 -->
<path d="M18 -6 C 12 -18,18 -32,34 -36 C 52 -40,62 -26,56 -12 C 48 -2,32 -4,24 -10 Z" fill="#ff1744" stroke="#b71c1c" stroke-width="2"/>
<path d="M28 -28 C 36 -32,46 -28,42 -18" fill="none" stroke="#ff5c77" stroke-width="2"/>
<path d="M20 -20 C 12 -14,10 -4,18 0" fill="none" stroke="#ff5c77" stroke-width="2"/>
<circle cx="40" cy="-24" r="4" fill="#ff80ab"/>
<circle cx="32" cy="-16" r="3" fill="#ff80ab"/>
<path d="M8 -4 Q 0 -10 -6 -4" fill="none" stroke="#2ecc71" stroke-width="2"/>
</g>
</svg>
<script>
const textList = [
"我想你","嘻嘻","又梦到你了","好想见你","爱你三千遍",
"小k","心动啦","抱抱我","亲亲","一直喜欢你",
"今天也想你","晚安","早安","想见你","超喜欢你",
"你在干嘛","我陪你","别难过","有我在","甜甜",
"喜欢你呀","命中注定","只想见你","未来同行","爱心递给你",
"你好可爱","我好爱你","永远在一起","慢慢喜欢你","偷偷想你",
"是你呀","就现在","靠近一点","抱抱你","亲亲你",
"我愿意","陪着你","不离开","偏爱你","只对你心动",
"你是我的小幸运","每天都想你","你真的很好","我一直都在","想和你见面",
"把心给你","心动不止一次","你是例外","你是偏爱","你是我想要的结局"
];
let heartNotes = [];
let fillNotes = [];
function createNote(x,y,text,isHeart){
const div = document.createElement('div');
const styleClass = "note-style-" + (Math.floor(Math.random()*5)+1);
div.className = "note " + styleClass;
div.innerText = text;
div.style.left = x + "px";
div.style.top = y + "px";
document.body.appendChild(div);
if(isHeart) heartNotes.push(div);
else fillNotes.push(div);
return div;
}
function sleep(ms){
return new Promise(resolve=>setTimeout(resolve,ms));
}
function createGoldParticles(x,y,count){
for(let i=0;i<count;i++){
const p = document.createElement('div');
p.className = "particle";
p.style.left = x + "px";
p.style.top = y + "px";
document.body.appendChild(p);
const angle = Math.random() * Math.PI * 2;
const speed = 60 + Math.random() * 180;
const vx = Math.cos(angle) * speed;
const vy = Math.sin(angle) * speed;
const size = 1 + Math.random() * 2;
p.style.width = size + "px";
p.style.height = size + "px";
const start = performance.now();
function animateParticle(time){
const t = (time - start) / 1000;
if(t > 1.1){ p.remove(); return; }
p.style.left = x + vx * t + "px";
p.style.top = y + vy * t + 180 * t * t + "px";
p.style.opacity = 1 - t * 0.9;
requestAnimationFrame(animateParticle);
}
requestAnimationFrame(animateParticle);
}
}
function explodeAllWithParticles(notesArray){
notesArray.forEach((note,index)=>{
setTimeout(()=>{
const rect = note.getBoundingClientRect();
const cx = rect.left + rect.width/2;
const cy = rect.top + rect.height/2;
createGoldParticles(cx, cy, 60);
note.remove();
}, index * 18);
});
}
(async function startAnimation(){
const cx = window.innerWidth / 2;
const cy = window.innerHeight / 2;
const person = document.getElementById("person");
for(let t = 0; t < 2 * Math.PI; t += 0.035){
const x = 16 * Math.pow(Math.sin(t), 3);
const y = 13 * Math.cos(t) - 5 * Math.cos(2*t) - 2 * Math.cos(3*t) - Math.cos(4*t);
const noteText = textList[Math.floor(Math.random()*textList.length)];
createNote(cx + x * 11, cy - y * 11, noteText, true);
await sleep(40);
}
await sleep(900);
heartNotes.forEach(el=>el.remove());
heartNotes = [];
const totalCount = 80;
const stageTotalTime = 4200;
const interval = stageTotalTime / totalCount;
for(let i = 0; i < totalCount; i++){
const maxX = Math.max(window.innerWidth - 120, 120);
const maxY = Math.max(window.innerHeight - 80, 80);
const x = Math.random() * maxX;
const y = Math.random() * maxY;
createNote(x, y, "爱你三千遍", false);
await sleep(interval);
}
await sleep(250);
explodeAllWithParticles(fillNotes);
fillNotes = [];
await sleep(700);
person.classList.add("show");
})();
</script>
</body>
</html>