Files
lunar-mini/mini/pages/wish-tree/wish-tree.wxss
T
gouki 63bcd9f412
Publish Mini Program Dev Version / publish (push) Successful in 4m10s
refactor(wish-tree): 用 WebGL 重写许愿树
- 移除 Canvas 2D 绘制,改用 WebGL
- 手写着色器实现光照和发光效果
- 树干使用圆柱体变形,带扭曲效果
- 树冠使用多层变形球体,带噪声
- 相机自动旋转,可触摸控制
- 保留陀螺仪和麦克风交互
- 简化场景,只保留一棵祈福树
- 深色主题 UI,金色点缀
2026-08-08 14:08:33 +00:00

317 lines
5.3 KiB
Plaintext

.container {
position: relative;
width: 100vw;
height: 100vh;
overflow: hidden;
background: linear-gradient(180deg, #0a0a1a 0%, #1a1a3a 50%, #0f2a4a 100%);
}
/* WebGL Canvas */
.webgl-canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
}
/* 顶部导航 */
.top-bar {
position: absolute;
top: 0;
left: 0;
right: 0;
padding: 100rpx 40rpx 30rpx;
display: flex;
justify-content: space-between;
align-items: flex-start;
z-index: 100;
pointer-events: none;
}
.top-bar .tree-info,
.top-bar .sensor-controls {
pointer-events: auto;
}
.tree-info {
display: flex;
flex-direction: column;
gap: 8rpx;
}
.tree-name {
font-size: 40rpx;
color: #ffd700;
font-weight: bold;
text-shadow: 0 2rpx 10rpx rgba(255, 215, 0, 0.5);
}
.tree-desc {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.7);
}
/* 传感器控制 */
.sensor-controls {
display: flex;
gap: 16rpx;
}
.sensor-btn {
width: 80rpx;
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.1);
border-radius: 50%;
border: 2rpx solid rgba(255, 255, 255, 0.2);
transition: all 0.3s;
}
.sensor-btn.active {
background: rgba(255, 215, 0, 0.3);
border-color: rgba(255, 215, 0, 0.6);
box-shadow: 0 0 30rpx rgba(255, 215, 0, 0.4);
}
.sensor-icon {
font-size: 40rpx;
}
/* 许愿按钮 */
.action-bar {
position: absolute;
bottom: 80rpx;
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);
}