refactor(wish-tree): 用 WebGL 重写许愿树
Publish Mini Program Dev Version / publish (push) Successful in 4m10s
Publish Mini Program Dev Version / publish (push) Successful in 4m10s
- 移除 Canvas 2D 绘制,改用 WebGL - 手写着色器实现光照和发光效果 - 树干使用圆柱体变形,带扭曲效果 - 树冠使用多层变形球体,带噪声 - 相机自动旋转,可触摸控制 - 保留陀螺仪和麦克风交互 - 简化场景,只保留一棵祈福树 - 深色主题 UI,金色点缀
This commit is contained in:
+111
-103
@@ -3,11 +3,11 @@
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background: #0f3460;
|
||||
background: linear-gradient(180deg, #0a0a1a 0%, #1a1a3a 50%, #0f2a4a 100%);
|
||||
}
|
||||
|
||||
/* 全屏画布 */
|
||||
.wish-tree-canvas {
|
||||
/* WebGL Canvas */
|
||||
.webgl-canvas {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
@@ -22,50 +22,35 @@
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 80rpx 30rpx 20rpx;
|
||||
padding: 100rpx 40rpx 30rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
z-index: 100;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.top-bar .tree-switcher,
|
||||
.top-bar .tree-info,
|
||||
.top-bar .sensor-controls {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.tree-switcher {
|
||||
.tree-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
padding: 10rpx 20rpx;
|
||||
border-radius: 40rpx;
|
||||
}
|
||||
|
||||
.switch-btn {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.switch-icon {
|
||||
font-size: 40rpx;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.tree-name {
|
||||
font-size: 32rpx;
|
||||
color: #fff;
|
||||
font-size: 40rpx;
|
||||
color: #ffd700;
|
||||
font-weight: bold;
|
||||
min-width: 150rpx;
|
||||
text-align: center;
|
||||
text-shadow: 0 2rpx 10rpx rgba(255, 215, 0, 0.5);
|
||||
}
|
||||
|
||||
.tree-desc {
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
/* 传感器控制 */
|
||||
@@ -75,29 +60,31 @@
|
||||
}
|
||||
|
||||
.sensor-btn {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
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.5);
|
||||
box-shadow: 0 0 20rpx rgba(255, 215, 0, 0.5);
|
||||
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: 36rpx;
|
||||
font-size: 40rpx;
|
||||
}
|
||||
|
||||
/* 许愿按钮 */
|
||||
.action-bar {
|
||||
position: absolute;
|
||||
bottom: 60rpx;
|
||||
bottom: 80rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 100;
|
||||
@@ -107,18 +94,26 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12rpx;
|
||||
background: linear-gradient(135deg, #C41E3A, #E74C3C);
|
||||
gap: 16rpx;
|
||||
background: linear-gradient(135deg, #c41e3a 0%, #e74c3c 50%, #ff6b6b 100%);
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
padding: 24rpx 60rpx;
|
||||
border-radius: 50rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
padding: 28rpx 80rpx;
|
||||
border-radius: 60rpx;
|
||||
border: none;
|
||||
box-shadow: 0 8rpx 30rpx rgba(196, 30, 58, 0.4);
|
||||
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: 36rpx;
|
||||
font-size: 44rpx;
|
||||
}
|
||||
|
||||
/* 弹窗 */
|
||||
@@ -137,7 +132,7 @@
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
@@ -145,34 +140,36 @@
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
border-radius: 32rpx 32rpx 0 0;
|
||||
max-height: 80vh;
|
||||
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: 30rpx;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
padding: 40rpx;
|
||||
border-bottom: 1rpx solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
font-size: 32rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
color: #ffd700;
|
||||
}
|
||||
|
||||
.modal-close {
|
||||
font-size: 48rpx;
|
||||
color: #999;
|
||||
font-size: 56rpx;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
padding: 10rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 30rpx;
|
||||
padding: 40rpx;
|
||||
max-height: 60vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
@@ -180,129 +177,140 @@
|
||||
/* 类型选择 */
|
||||
.type-selector {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
margin-bottom: 30rpx;
|
||||
gap: 24rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.type-item {
|
||||
flex: 1;
|
||||
padding: 24rpx;
|
||||
border: 2rpx solid #eee;
|
||||
border-radius: 16rpx;
|
||||
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: #C41E3A;
|
||||
background: #FFF5F5;
|
||||
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: 28rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 8rpx;
|
||||
color: #fff;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.type-desc {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
|
||||
/* 输入框 */
|
||||
.wish-input {
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
padding: 20rpx;
|
||||
border: 2rpx solid #eee;
|
||||
border-radius: 16rpx;
|
||||
font-size: 28rpx;
|
||||
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: 22rpx;
|
||||
color: #999;
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
/* 商品选择 */
|
||||
.product-section {
|
||||
margin-top: 30rpx;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 20rpx;
|
||||
color: #ffd700;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.product-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16rpx;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.product-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 24rpx;
|
||||
border: 2rpx solid #eee;
|
||||
border-radius: 16rpx;
|
||||
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: #C41E3A;
|
||||
background: #FFF5F5;
|
||||
border-color: #ffd700;
|
||||
background: rgba(255, 215, 0, 0.1);
|
||||
}
|
||||
|
||||
.product-name {
|
||||
font-size: 28rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.product-desc {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.product-price {
|
||||
font-size: 32rpx;
|
||||
font-size: 40rpx;
|
||||
font-weight: bold;
|
||||
color: #C41E3A;
|
||||
color: #ffd700;
|
||||
}
|
||||
|
||||
/* 底部按钮 */
|
||||
.modal-footer {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
padding: 30rpx;
|
||||
border-top: 1rpx solid #eee;
|
||||
gap: 24rpx;
|
||||
padding: 40rpx;
|
||||
border-top: 1rpx solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.modal-footer button {
|
||||
flex: 1;
|
||||
padding: 24rpx;
|
||||
border-radius: 50rpx;
|
||||
font-size: 28rpx;
|
||||
padding: 28rpx;
|
||||
border-radius: 60rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.btn-outline {
|
||||
background: #fff;
|
||||
border: 2rpx solid #C41E3A;
|
||||
color: #C41E3A;
|
||||
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, #E74C3C);
|
||||
background: linear-gradient(135deg, #c41e3a 0%, #e74c3c 100%);
|
||||
color: #fff;
|
||||
border: none;
|
||||
box-shadow: 0 8rpx 30rpx rgba(196, 30, 58, 0.4);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user