gsap实现按钮按住不放删除动画代码
代码语言:html
所属分类:其他
代码由claude-4.6 ai生成,可能有错误,仅供参考:点击查看提示词
代码描述:按钮按住不放删除动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GSAP 炫酷按住删除按钮</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"></script>
<style>
/* ── 基础重置 ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
--bg: #0a0a0f;
--card: #13131a;
--border: #1e1e2e;
--red: #ff3b5c;
--red-dark: #c0002a;
--red-glow: rgba(255, 59, 92, 0.4);
--orange: #ff6b35;
--yellow: #ffd60a;
--text: #e2e8f0;
--text2: #64748b;
--radius: 16px;
}
body {
background: var(--bg);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
color: var(--text);
overflow: hidden;
gap: 60px;
}
/* ── 背景粒子网格 ── */
body::before {
content: '';
position: fixed;
inset: 0;
background-image:
radial-gradient(circle at 20% 30%, rgba(255,59,92,0.06) 0%, transparent 50%),
radial-gradient(circle at 80% 70%, rgba(255,107,53,0.05) 0%, transparent 50%),
linear-gradient(rgba(255,255,255,.015) 1px, transparent 1px),
linear-gradient(90deg, rgba(255,255,255,.015) 1px, transparent 1px);
background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
pointer-events: none;
z-index: 0;
}
.page-title {
position: relative;
z-index: 1;
text-align: center;
}
.page-title h1 {
font-size: 28px;
font-weight: 800;
background: linear-gradient(135deg, #ff3b5c, #ff6b35, #ffd60a);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
letter-spacing: -0.5px;
margin-bottom: 8px;
}
.page-title p {
font-size: 13px;
color: var(--text2);
letter-spacing: 0.3px;
}
/* ══════════════════════════════════════
按钮展示区
══════════════════════════════════════ */
.demo-grid {
position: relative;
z-index: 1;
display: flex;
flex-wrap: wrap;
gap: 32px;
align-items: center;
justify-content: center;
padding: 0 24px;
}
/* ══════════════════════════════════════
样式 1 ── 圆形进度描边
══════════════════════════════════════ */
.btn-circle-wrap {
display: flex;
flex-direction: column;
align-items: center;
gap: 14px;
}
.btn-circle-label {
font-size: 11px;
color: var(--text2);
text-transform: uppercase;
letter-spacing: 1px;
}
.btn-circle {
position: relative;
width: 80px;
height: 80px;
cursor: pointer;
user-select: none;
-webkit-user-select: none;
}
.btn-circle svg {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
transform: rotate(-90deg);
pointer-events: none;
}
.btn-circle .track-bg {
fill: none;
stroke: rgba(255,59,92,0.15);
stroke-width: 3;
}
.btn-circle .track-progress {
fill: none;
stroke: url(#circleGrad);
stroke-width: 3;
stroke-linecap: round;
stroke-dasharray: 220;
stroke-dashoffset: 220;
filter: drop-shadow(0 0 6px rgba(255,59,92,0.8));
transition: none;
}
.btn-circle-inner {
position: absolute;
inset: 6px;
border-radius: 50%;
background: linear-gradient(135deg, #1a0a0f, #13131a);
border: 1.5px solid rgba(255,59,92,0.2);
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
gap: 4px;
overflow: hidden;
transition: border-color 0.3s;
}
.btn-circle:hover .btn-circle-inner {
border-color: rgba(255,59,92,0.5);
}
.btn-circle-inner .icon {
font-size: 22px;
line-height: 1;
position: relative;
z-index: 1;
transition: transform 0.3s;
}
.btn-circle-inner .hint-text {
font-size: 9px;
color: var(--text2);
letter-spacing: 0.3px;
position: relative;
z-index: 1;
}
/* 圆形按钮内部红色填充波纹 */
.btn-circle-inner .fill-wave {
position: absolute;
inset: 0;
background: radial-gradient(circle at 50% 110%, #ff3b5c 0%, #c0002a 60%, transparent 100%);
transform: translateY(100%);
border-radius: 50%;
}
/* ══════════════════════════════════════
样式 2 ── 线性进度条横条
══════════════════════════════════════ */
.btn-bar {
position: relative;
width: 200px;
height: 56px;
cursor: pointer;
user-select: none;
-webkit-user-select: none;
border-radius: 14px;
background: linear-gradient(135deg, #1a0a0f, #160d10);.........完整代码请登录后点击上方下载按钮下载查看















网友评论0