Files
lunar-mini/mini/pages/wish-tree/wish-tree.wxss
T
gouki 81cfe76e2b refactor(wish-tree): 参考 wishing-tree-pages 重写许愿树
- 使用精美许愿树 PNG 图片作为背景
- 许愿标签用 CSS 动画实现摇摆效果
- 添加萤火虫和花瓣氛围动画
- 预设树冠挂载点,标签位置更自然
- 深色主题 + 金色/红色/绿色标签
- 边缘暗角让树从中心发光
- 最近心愿横向滚动列表
2026-08-08 16:49:57 +00:00

534 lines
8.7 KiB
Plaintext

.container {
position: relative;
width: 100vw;
height: 100vh;
overflow: hidden;
background: #0d0d1a;
}
/* 背景氛围 */
.ambiance {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 1;
}
.firefly {
position: absolute;
border-radius: 50%;
background: #ffd700;
box-shadow: 0 0 8px #ffd700, 0 0 14px #ffd700;
animation: twinkle 3s ease-in-out infinite;
}
.petals {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 1;
}
.petal {
position: absolute;
top: -20px;
border-radius: 50% 50% 50% 0;
background: rgba(255, 200, 200, 0.6);
animation: drift 12s linear infinite;
}
/* 边缘暗角 */
.vignette {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: radial-gradient(120% 90% at 50% 30%, transparent 40%, rgba(13, 13, 26, 0.9) 100%);
pointer-events: none;
z-index: 2;
}
/* 主内容 */
.main-content {
position: relative;
z-index: 10;
display: flex;
flex-direction: column;
align-items: center;
min-height: 100vh;
padding: 60rpx 40rpx 200rpx;
}
/* 头部 */
.header {
text-align: center;
margin-bottom: 20rpx;
}
.subtitle {
display: block;
font-size: 20rpx;
letter-spacing: 8rpx;
color: rgba(255, 215, 0, 0.8);
margin-bottom: 16rpx;
}
.title {
display: block;
font-size: 72rpx;
font-weight: bold;
color: #ffd700;
text-shadow: 0 4rpx 24rpx rgba(255, 215, 0, 0.4);
margin-bottom: 24rpx;
}
.description {
display: block;
font-size: 26rpx;
color: rgba(255, 255, 255, 0.7);
line-height: 1.6;
max-width: 500rpx;
margin: 0 auto 20rpx;
}
.wish-count {
display: block;
font-size: 24rpx;
color: rgba(255, 215, 0, 0.7);
}
.wish-count .count {
font-weight: bold;
color: #ffd700;
}
/* 许愿树容器 */
.tree-container {
position: relative;
width: 100%;
max-width: 700rpx;
aspect-ratio: 1;
margin: 0 auto;
}
.tree-image {
width: 100%;
height: 100%;
object-fit: contain;
}
/* 许愿标签 */
.wish-tag {
position: absolute;
z-index: 20;
transform: translateX(-50%);
display: flex;
flex-direction: column;
align-items: center;
}
.wish-tag.new {
animation: tag-drop 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.tag-sway {
display: flex;
flex-direction: column;
align-items: center;
transform-origin: top center;
animation: sway 4s ease-in-out infinite;
}
.tag-string {
width: 2rpx;
height: 40rpx;
}
.tag-knot {
width: 12rpx;
height: 12rpx;
border-radius: 50%;
margin-top: -2rpx;
}
.tag-content {
margin-top: 8rpx;
padding: 16rpx 20rpx;
border-radius: 12rpx;
min-width: 160rpx;
max-width: 200rpx;
backdrop-filter: blur(4px);
transition: transform 0.3s;
}
.wish-tag:active .tag-content {
transform: translateY(-4rpx) scale(1.05);
}
.tag-text {
display: block;
font-size: 20rpx;
font-weight: 500;
color: #2a2a3a;
line-height: 1.4;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.tag-author {
display: block;
font-size: 16rpx;
color: #4a4a5a;
margin-top: 8rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* 最近的心愿 */
.recent-section {
width: 100%;
margin-top: 40rpx;
}
.section-title {
display: block;
text-align: center;
font-size: 22rpx;
letter-spacing: 6rpx;
color: rgba(255, 255, 255, 0.5);
margin-bottom: 24rpx;
}
.recent-list {
display: flex;
gap: 20rpx;
padding-bottom: 20rpx;
white-space: nowrap;
}
.recent-item {
display: inline-flex;
flex-direction: column;
min-width: 280rpx;
padding: 24rpx;
background: rgba(255, 255, 255, 0.08);
border: 1rpx solid rgba(255, 255, 255, 0.1);
border-radius: 20rpx;
backdrop-filter: blur(8px);
}
.recent-text {
font-size: 26rpx;
color: rgba(255, 255, 255, 0.9);
line-height: 1.5;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.recent-author {
font-size: 22rpx;
color: rgba(255, 255, 255, 0.5);
margin-top: 12rpx;
}
/* 许愿按钮 */
.action-bar {
position: fixed;
bottom: 60rpx;
left: 50%;
transform: translateX(-50%);
z-index: 100;
}
.btn-wish {
display: flex;
align-items: center;
justify-content: center;
gap: 16rpx;
background: linear-gradient(135deg, #c41e3a 0%, #e74c3c 50%, #ff6b6b 100%);
color: #fff;
font-size: 36rpx;
font-weight: bold;
padding: 28rpx 80rpx;
border-radius: 60rpx;
border: none;
box-shadow: 0 10rpx 40rpx rgba(196, 30, 58, 0.5),
0 0 60rpx rgba(255, 107, 107, 0.3);
transition: all 0.3s;
}
.btn-wish:active {
transform: scale(0.95);
box-shadow: 0 5rpx 20rpx rgba(196, 30, 58, 0.4);
}
.btn-wish .icon {
font-size: 44rpx;
}
/* 弹窗 */
.modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1000;
}
.modal-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.7);
}
.modal-content {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(180deg, #2a2a4a 0%, #1a1a2e 100%);
border-radius: 40rpx 40rpx 0 0;
max-height: 85vh;
overflow: hidden;
border-top: 2rpx solid rgba(255, 215, 0, 0.3);
}
.modal-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 40rpx;
border-bottom: 1rpx solid rgba(255, 255, 255, 0.1);
}
.modal-title {
font-size: 36rpx;
font-weight: bold;
color: #ffd700;
}
.modal-close {
font-size: 56rpx;
color: rgba(255, 255, 255, 0.5);
padding: 10rpx;
line-height: 1;
}
.modal-body {
padding: 40rpx;
max-height: 60vh;
overflow-y: auto;
}
/* 类型选择 */
.type-selector {
display: flex;
gap: 24rpx;
margin-bottom: 40rpx;
}
.type-item {
flex: 1;
padding: 32rpx;
border: 2rpx solid rgba(255, 255, 255, 0.2);
border-radius: 20rpx;
text-align: center;
transition: all 0.3s;
background: rgba(255, 255, 255, 0.05);
}
.type-item.active {
border-color: #ffd700;
background: rgba(255, 215, 0, 0.1);
box-shadow: 0 0 30rpx rgba(255, 215, 0, 0.2);
}
.type-name {
display: block;
font-size: 32rpx;
font-weight: bold;
color: #fff;
margin-bottom: 12rpx;
}
.type-desc {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.6);
}
/* 输入框 */
.wish-input {
width: 100%;
height: 240rpx;
padding: 28rpx;
border: 2rpx solid rgba(255, 255, 255, 0.2);
border-radius: 20rpx;
font-size: 30rpx;
box-sizing: border-box;
background: rgba(255, 255, 255, 0.08);
color: #fff;
}
.wish-input::placeholder {
color: rgba(255, 255, 255, 0.4);
}
.input-count {
text-align: right;
font-size: 24rpx;
color: rgba(255, 255, 255, 0.5);
margin-top: 16rpx;
}
/* 商品选择 */
.product-section {
margin-top: 40rpx;
}
.section-title {
font-size: 32rpx;
font-weight: bold;
color: #ffd700;
margin-bottom: 24rpx;
}
.product-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.product-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 32rpx;
border: 2rpx solid rgba(255, 255, 255, 0.15);
border-radius: 20rpx;
transition: all 0.3s;
background: rgba(255, 255, 255, 0.05);
}
.product-item.active {
border-color: #ffd700;
background: rgba(255, 215, 0, 0.1);
}
.product-name {
font-size: 32rpx;
font-weight: bold;
color: #fff;
}
.product-desc {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.6);
margin-top: 8rpx;
}
.product-price {
font-size: 40rpx;
font-weight: bold;
color: #ffd700;
}
/* 底部按钮 */
.modal-footer {
display: flex;
gap: 24rpx;
padding: 40rpx;
border-top: 1rpx solid rgba(255, 255, 255, 0.1);
}
.modal-footer button {
flex: 1;
padding: 28rpx;
border-radius: 60rpx;
font-size: 32rpx;
font-weight: bold;
}
.btn-outline {
background: transparent;
border: 2rpx solid rgba(255, 255, 255, 0.3);
color: rgba(255, 255, 255, 0.8);
}
.btn-primary {
background: linear-gradient(135deg, #c41e3a 0%, #e74c3c 100%);
color: #fff;
border: none;
box-shadow: 0 8rpx 30rpx rgba(196, 30, 58, 0.4);
}
/* 动画 */
@keyframes sway {
0%, 100% {
transform: rotate(-3.5deg);
}
50% {
transform: rotate(3.5deg);
}
}
@keyframes twinkle {
0%, 100% {
opacity: 0.2;
transform: scale(0.7);
}
50% {
opacity: 1;
transform: scale(1.15);
}
}
@keyframes drift {
0% {
transform: translate3d(0, 0, 0) rotate(0deg);
opacity: 0;
}
10% {
opacity: 0.9;
}
90% {
opacity: 0.9;
}
100% {
transform: translate3d(-40px, 120vh, 0) rotate(360deg);
opacity: 0;
}
}
@keyframes tag-drop {
0% {
transform: translateY(-24px) rotate(-8deg);
opacity: 0;
}
60% {
transform: translateY(4px) rotate(3deg);
opacity: 1;
}
100% {
transform: translateY(0) rotate(0deg);
opacity: 1;
}
}