ProjectGenesis commited on
Commit
e7dc0e7
·
verified ·
1 Parent(s): 719c767

Promote version 682bd85 to main

Browse files

Promoted commit 682bd85a8457683b08dbec2413c891ab27f51aaa to main branch

Files changed (2) hide show
  1. script.js +5 -67
  2. style.css +1 -22
script.js CHANGED
@@ -66,12 +66,10 @@ document.addEventListener('DOMContentLoaded', () => {
66
  // Get random reward based on rarity
67
  const possibleRewards = rewards.filter(r => r.rarity === rarities[randomIndex]);
68
  const reward = possibleRewards[Math.floor(Math.random() * possibleRewards.length)];
 
69
  const popup = document.createElement('reward-popup');
70
  document.body.appendChild(popup);
71
- setTimeout(() => {
72
- popup.show(reward);
73
- createConfettiBurst();
74
- }, 1000);
75
  }, 800);
76
 
77
  // Reset after animation
@@ -82,69 +80,9 @@ document.addEventListener('DOMContentLoaded', () => {
82
  }, 3000);
83
  }, 4000);
84
  });
85
- function createConfettiBurst() {
86
- const colors = ['#FFD700', '#FF8C00', '#00FFAA', '#00AAFF', '#AA00FF'];
87
- const container = document.createElement('div');
88
- container.style.position = 'fixed';
89
- container.style.top = '0';
90
- container.style.left = '0';
91
- container.style.width = '100%';
92
- container.style.height = '100%';
93
- container.style.pointerEvents = 'none';
94
- container.style.zIndex = '999';
95
- document.body.appendChild(container);
96
-
97
- for (let i = 0; i < 150; i++) {
98
- const confetti = document.createElement('div');
99
- confetti.style.position = 'absolute';
100
- confetti.style.width = '10px';
101
- confetti.style.height = '10px';
102
- confetti.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
103
- confetti.style.borderRadius = '50%';
104
- confetti.style.opacity = '0.8';
105
-
106
- const startX = Math.random() * window.innerWidth;
107
- const startY = -10;
108
- const endY = window.innerHeight + 10;
109
- const rotation = Math.random() * 360;
110
- const scale = 0.5 + Math.random() * 1.5;
111
- const duration = 3 + Math.random() * 2;
112
- const delay = Math.random() * 0.5;
113
-
114
- confetti.style.left = `${startX}px`;
115
- confetti.style.top = `${startY}px`;
116
- confetti.style.transform = `rotate(${rotation}deg) scale(${scale})`;
117
-
118
- container.appendChild(confetti);
119
-
120
- const animation = confetti.animate([
121
- {
122
- top: `${startY}px`,
123
- transform: `rotate(${rotation}deg) scale(${scale})`,
124
- opacity: 0.8
125
- },
126
- {
127
- top: `${endY}px`,
128
- transform: `rotate(${rotation + 360}deg) scale(${scale})`,
129
- opacity: 0
130
- }
131
- ], {
132
- duration: duration * 1000,
133
- delay: delay * 1000,
134
- easing: 'cubic-bezier(0.1, 0.8, 0.3, 1)'
135
- });
136
-
137
- animation.onfinish = () => {
138
- confetti.remove();
139
- if (container.children.length === 0) {
140
- container.remove();
141
- }
142
- };
143
- }
144
- }
145
-
146
- function createCoinBurst(box) {
147
- for (let i = 0; i < 12; i++) {
148
  const coin = document.createElement('div');
149
  coin.className = 'coin-particle';
150
 
 
66
  // Get random reward based on rarity
67
  const possibleRewards = rewards.filter(r => r.rarity === rarities[randomIndex]);
68
  const reward = possibleRewards[Math.floor(Math.random() * possibleRewards.length)];
69
+
70
  const popup = document.createElement('reward-popup');
71
  document.body.appendChild(popup);
72
+ setTimeout(() => popup.show(reward), 1000);
 
 
 
73
  }, 800);
74
 
75
  // Reset after animation
 
80
  }, 3000);
81
  }, 4000);
82
  });
83
+
84
+ function createCoinBurst(box) {
85
+ for (let i = 0; i < 12; i++) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  const coin = document.createElement('div');
87
  coin.className = 'coin-particle';
88
 
style.css CHANGED
@@ -8,6 +8,7 @@
8
  50% { transform: translateY(-20px) scale(1.1); }
9
  100% { transform: translateY(0) scale(1.1); }
10
  }
 
11
  @keyframes particle-burst {
12
  0% {
13
  opacity: 0;
@@ -20,28 +21,6 @@
20
  }
21
  }
22
 
23
- @keyframes confetti-fall {
24
- 0% {
25
- transform: translateY(-100px) rotate(0deg);
26
- opacity: 1;
27
- }
28
- 100% {
29
- transform: translateY(100vh) rotate(360deg);
30
- opacity: 0;
31
- }
32
- }
33
-
34
- 0% {
35
- opacity: 0;
36
- transform: scale(0.5) translate(0, 0);
37
- }
38
- 20% { opacity: 1; }
39
- 100% {
40
- opacity: 0;
41
- transform: scale(2) translate(var(--tx), var(--ty));
42
- }
43
- }
44
-
45
  .loot-box {
46
  position: relative;
47
  width: 140px;
 
8
  50% { transform: translateY(-20px) scale(1.1); }
9
  100% { transform: translateY(0) scale(1.1); }
10
  }
11
+
12
  @keyframes particle-burst {
13
  0% {
14
  opacity: 0;
 
21
  }
22
  }
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  .loot-box {
25
  position: relative;
26
  width: 140px;