Browse Source

Merge branch 'milestone-20250826-财富金轮' of http://39.101.133.168:8807/hongxilin/AIxiaocaishen into milestone-20250826-财富金轮

milestone-20250826-财富金轮
maziyang 3 days ago
parent
commit
0810f9cfe3
  1. 55
      src/views/wealth/goldenWheel.vue

55
src/views/wealth/goldenWheel.vue

@ -258,11 +258,12 @@ export default {
showNoTimesModal: false,
showRuleModal: false,
isFirstVisit: true,
currentRotation: -23.5, // -22.5
currentRotation: -22.5, // -22.5
noTimesTimer: null,
prizeMessage: '',
prizeAmount: '',
textWidth: 0,
targetRotation: 0, // ,
historyRecordListVisible: false,
nowMonths: [],
@ -479,6 +480,37 @@ async loadHistoryRecord() {
}
},
//
calculateRandomStop() {
// 845
const sectorDegrees = 45;
// (0-7)
const randomSector = Math.floor(Math.random() * 8);
// (-22.5)
// = * 45 - 22.5
const targetAngle = randomSector * sectorDegrees - 22.5;
//
// 3-5
const extraRotations = 5 + Math.floor(Math.random() * 3); // 3-5
const extraDegrees = extraRotations * 360;
//
//
//
let rotationNeeded = targetAngle - this.currentRotation;
// 360使
if (rotationNeeded < 0) {
rotationNeeded += 360;
}
//
return this.currentRotation + rotationNeeded + extraDegrees;
},
//
async handleSpin() {
if (this.showRuleModal || this.isFirstVisit || this.isSpinning) return;
@ -501,9 +533,14 @@ async loadHistoryRecord() {
//
this.isSpinning = true;
// -22.5
const newRotation = this.currentRotation + 1440;
this.currentRotation = newRotation;
//
this.targetRotation = this.calculateRandomStop();
// CSS
document.documentElement.style.setProperty('--target-rotation', `${this.targetRotation}deg`);
//
this.currentRotation = this.targetRotation;
// API
const success = await this.fetchPrizeInfo();
@ -708,7 +745,7 @@ async loadHistoryRecord() {
}
.wheel-img.spinning {
animation: optimal-spin 3s cubic-bezier(0.17, 0.67, 0.21, 0.98) forwards;
animation: optimal-spin 3s cubic-bezier(0.47, 0.57, 0.45, 0.15) forwards;
backface-visibility: hidden;
transform: translateZ(0);
}
@ -717,8 +754,14 @@ async loadHistoryRecord() {
0% {
transform: rotate(-22.5deg); /* 从-22.5度开始旋转 */
}
20% {
transform: rotate(calc(-22.5deg + (var(--target-rotation, 1440deg) + 22.5deg) * 0.2)); /* 加速阶段 */
}
80% {
transform: rotate(calc(-22.5deg + (var(--target-rotation, 1440deg) + 22.5deg) * 0.8)); /* 减速阶段 */
}
100% {
transform: rotate(1417.5deg); /* 1440 - 22.5 = 1417.5度 */
transform: rotate(var(--target-rotation, 1417.5deg)); /* 使用CSS变量控制最终旋转角度 */
}
}

Loading…
Cancel
Save