lighteningcards 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +14 -0
- package/ASSET_SETUP.md +92 -0
- package/copy-assets.js +65 -0
- package/dist/index.cjs.js +302 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.css +2 -0
- package/dist/index.css.map +1 -0
- package/dist/index.esm.js +300 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +51 -0
- package/rollup.config.js +79 -0
- package/src/LighteningCard.css +19 -0
- package/src/LighteningCard.js +81 -0
- package/src/assetLoader.js +57 -0
- package/src/hooks/useLeftThunder.js +62 -0
- package/src/hooks/useLightening.js +136 -0
- package/src/hooks/useRightThunder.js +60 -0
- package/src/index.js +3 -0
package/.babelrc
ADDED
package/ASSET_SETUP.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Lightning Cards - Asset Setup Guide
|
|
2
|
+
|
|
3
|
+
## 🚨 Quick Fix for Asset Loading Issue
|
|
4
|
+
|
|
5
|
+
The animation asset needs to be accessible to your React application. Here are **3 simple solutions**:
|
|
6
|
+
|
|
7
|
+
### Solution 1: Copy Asset to Public Folder (Recommended)
|
|
8
|
+
|
|
9
|
+
1. **Copy the asset file:**
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# From your React app directory, run:
|
|
13
|
+
cp node_modules/lighteningcards/dist/thunders_one.json public/thunders_one.json
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
2. **Restart your React development server:**
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm start
|
|
20
|
+
# or
|
|
21
|
+
yarn start
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
3. **Use the component:**
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
import LighteningCard from "lighteningcards";
|
|
28
|
+
import "lighteningcards/dist/index.css";
|
|
29
|
+
|
|
30
|
+
<LighteningCard roundStatus="active" cards={[]} />;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Solution 2: Use the Copy Script
|
|
34
|
+
|
|
35
|
+
1. **Run the helper script from your React app directory:**
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
node node_modules/lighteningcards/copy-assets.js
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
2. **Restart your development server**
|
|
42
|
+
|
|
43
|
+
### Solution 3: Manual Asset Management
|
|
44
|
+
|
|
45
|
+
1. **Download the asset** from `node_modules/lighteningcards/dist/thunders_one.json`
|
|
46
|
+
2. **Place it in your React app's `public` folder**
|
|
47
|
+
3. **Restart your development server**
|
|
48
|
+
|
|
49
|
+
## 🔧 Alternative: Use Custom Asset Path
|
|
50
|
+
|
|
51
|
+
If you want to place the asset elsewhere:
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
<LighteningCard
|
|
55
|
+
roundStatus="active"
|
|
56
|
+
cards={[]}
|
|
57
|
+
assetPath="/path/to/your/thunders_one.json"
|
|
58
|
+
/>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 🛠️ Troubleshooting
|
|
62
|
+
|
|
63
|
+
### Error: "Unexpected token '<', "<!doctype "... is not valid JSON"
|
|
64
|
+
|
|
65
|
+
This means the server returned an HTML page instead of the JSON file. The asset is not accessible at the specified path.
|
|
66
|
+
|
|
67
|
+
**Fix:** Make sure `thunders_one.json` is in your React app's `public` folder.
|
|
68
|
+
|
|
69
|
+
### Error: "Failed to load animation"
|
|
70
|
+
|
|
71
|
+
The component will now show a fallback animation (green rectangles) if the asset can't be loaded.
|
|
72
|
+
|
|
73
|
+
## 📁 File Structure
|
|
74
|
+
|
|
75
|
+
Your React app should have:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
your-react-app/
|
|
79
|
+
├── public/
|
|
80
|
+
│ └── thunders_one.json ← Copy the asset here
|
|
81
|
+
├── src/
|
|
82
|
+
│ └── your-components.js
|
|
83
|
+
└── package.json
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## ✅ Verification
|
|
87
|
+
|
|
88
|
+
After copying the asset, you should be able to access it at:
|
|
89
|
+
|
|
90
|
+
- `http://localhost:3000/thunders_one.json` (or your dev server port)
|
|
91
|
+
|
|
92
|
+
If you see JSON data instead of an HTML page, you're all set!
|
package/copy-assets.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
// This script helps copy the animation asset to your React app's public folder
|
|
7
|
+
console.log("🚀 Lightning Cards - Asset Copy Helper");
|
|
8
|
+
console.log("=====================================");
|
|
9
|
+
|
|
10
|
+
// Check if we're in a React app (look for package.json with react dependency)
|
|
11
|
+
const packageJsonPath = path.join(process.cwd(), "package.json");
|
|
12
|
+
const isReactApp = fs.existsSync(packageJsonPath);
|
|
13
|
+
|
|
14
|
+
if (isReactApp) {
|
|
15
|
+
try {
|
|
16
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
17
|
+
const hasReact =
|
|
18
|
+
packageJson.dependencies?.react || packageJson.devDependencies?.react;
|
|
19
|
+
|
|
20
|
+
if (hasReact) {
|
|
21
|
+
console.log("✅ React app detected!");
|
|
22
|
+
|
|
23
|
+
// Create public folder if it doesn't exist
|
|
24
|
+
const publicDir = path.join(process.cwd(), "public");
|
|
25
|
+
if (!fs.existsSync(publicDir)) {
|
|
26
|
+
fs.mkdirSync(publicDir, { recursive: true });
|
|
27
|
+
console.log("📁 Created public directory");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Copy the asset
|
|
31
|
+
const sourceAsset = path.join(__dirname, "dist", "thunders_one.json");
|
|
32
|
+
const targetAsset = path.join(publicDir, "thunders_one.json");
|
|
33
|
+
|
|
34
|
+
if (fs.existsSync(sourceAsset)) {
|
|
35
|
+
fs.copyFileSync(sourceAsset, targetAsset);
|
|
36
|
+
console.log("✅ Copied thunders_one.json to public folder");
|
|
37
|
+
console.log("📍 Asset location:", targetAsset);
|
|
38
|
+
console.log("");
|
|
39
|
+
console.log("🎉 You can now use Lightning Cards in your React app!");
|
|
40
|
+
console.log("");
|
|
41
|
+
console.log("Usage:");
|
|
42
|
+
console.log('import LighteningCard from "lighteningcards";');
|
|
43
|
+
console.log('import "lighteningcards/dist/index.css";');
|
|
44
|
+
console.log("");
|
|
45
|
+
console.log('<LighteningCard roundStatus="active" cards={[]} />');
|
|
46
|
+
} else {
|
|
47
|
+
console.log('❌ Asset not found. Please run "npm run build" first.');
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
console.log("❌ This doesn't appear to be a React app.");
|
|
51
|
+
}
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.log("❌ Error reading package.json:", error.message);
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
console.log(
|
|
57
|
+
"❌ No package.json found. Please run this from your React app directory."
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
console.log("");
|
|
62
|
+
console.log("📖 Manual Instructions:");
|
|
63
|
+
console.log("1. Copy dist/thunders_one.json to your React app's public folder");
|
|
64
|
+
console.log("2. Restart your React development server");
|
|
65
|
+
console.log("3. Use the component as shown above");
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var PropTypes = require('prop-types');
|
|
5
|
+
var pixi_js = require('pixi.js');
|
|
6
|
+
|
|
7
|
+
const useLeftThunder = () => {
|
|
8
|
+
class LeftThunder {
|
|
9
|
+
constructor(spritePath, appRef) {
|
|
10
|
+
this.spritePath = spritePath;
|
|
11
|
+
this.appRef = appRef;
|
|
12
|
+
this.initiateAnimation();
|
|
13
|
+
}
|
|
14
|
+
async initiateAnimation() {
|
|
15
|
+
pixi_js.Assets.load(this.spritePath).then(baseTexture => {
|
|
16
|
+
var _baseTexture$resource, _baseTexture$resource2;
|
|
17
|
+
// Ensure the animation is visible and sized correctly
|
|
18
|
+
const frames = [];
|
|
19
|
+
// Get the correct texture dimensions
|
|
20
|
+
const texWidth = ((_baseTexture$resource = baseTexture.resource) === null || _baseTexture$resource === void 0 ? void 0 : _baseTexture$resource.width) || baseTexture.width;
|
|
21
|
+
const texHeight = ((_baseTexture$resource2 = baseTexture.resource) === null || _baseTexture$resource2 === void 0 ? void 0 : _baseTexture$resource2.height) || baseTexture.height;
|
|
22
|
+
const columns = 3;
|
|
23
|
+
const rows = 10;
|
|
24
|
+
const frameWidth = texWidth / columns;
|
|
25
|
+
const frameHeight = texHeight / rows;
|
|
26
|
+
|
|
27
|
+
// Row-major order: for each row, for each column
|
|
28
|
+
for (let row = 0; row < rows; row++) {
|
|
29
|
+
for (let col = 0; col < columns; col++) {
|
|
30
|
+
const x = col * frameWidth;
|
|
31
|
+
const y = row * frameHeight;
|
|
32
|
+
const frameRect = new pixi_js.Rectangle(x, y, frameWidth, frameHeight);
|
|
33
|
+
frames.push(new pixi_js.Texture({
|
|
34
|
+
source: baseTexture.source,
|
|
35
|
+
// Use the correct source for the Texture constructor
|
|
36
|
+
frame: frameRect
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Create and configure the AnimatedSprite
|
|
42
|
+
const animatedSprite = new pixi_js.AnimatedSprite(frames);
|
|
43
|
+
animatedSprite.animationSpeed = 0.25; // Faster speed for more visible animation
|
|
44
|
+
animatedSprite.loop = true;
|
|
45
|
+
animatedSprite.scale.set(0.4);
|
|
46
|
+
animatedSprite.anchor.set(0.5, 0.5);
|
|
47
|
+
|
|
48
|
+
// Center the sprite in the canvas
|
|
49
|
+
animatedSprite.x = this.appRef.current.renderer.width / 2;
|
|
50
|
+
animatedSprite.y = this.appRef.current.renderer.height / 2;
|
|
51
|
+
this.appRef.current.stage.addChild(animatedSprite);
|
|
52
|
+
animatedSprite.play();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
LeftThunder
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const useRightThunder = () => {
|
|
62
|
+
class RightThunder {
|
|
63
|
+
constructor(spritePath, appRef) {
|
|
64
|
+
this.spritePath = spritePath;
|
|
65
|
+
this.appRef = appRef;
|
|
66
|
+
this.initiateAnimation();
|
|
67
|
+
}
|
|
68
|
+
async initiateAnimation() {
|
|
69
|
+
pixi_js.Assets.load(this.spritePath).then(baseTexture => {
|
|
70
|
+
var _baseTexture$resource, _baseTexture$resource2;
|
|
71
|
+
// Ensure the animation is visible and sized correctly
|
|
72
|
+
const frames = [];
|
|
73
|
+
|
|
74
|
+
// Get the correct texture dimensions
|
|
75
|
+
const texWidth = ((_baseTexture$resource = baseTexture.resource) === null || _baseTexture$resource === void 0 ? void 0 : _baseTexture$resource.width) || baseTexture.width;
|
|
76
|
+
const texHeight = ((_baseTexture$resource2 = baseTexture.resource) === null || _baseTexture$resource2 === void 0 ? void 0 : _baseTexture$resource2.height) || baseTexture.height;
|
|
77
|
+
const columns = 3;
|
|
78
|
+
const rows = 10;
|
|
79
|
+
const frameWidth = texWidth / columns;
|
|
80
|
+
const frameHeight = texHeight / rows;
|
|
81
|
+
|
|
82
|
+
// Row-major order: for each row, for each column
|
|
83
|
+
for (let row = 0; row < rows; row++) {
|
|
84
|
+
for (let col = 0; col < columns; col++) {
|
|
85
|
+
const x = col * frameWidth;
|
|
86
|
+
const y = row * frameHeight;
|
|
87
|
+
const frameRect = new pixi_js.Rectangle(x, y, frameWidth, frameHeight);
|
|
88
|
+
frames.push(new pixi_js.Texture({
|
|
89
|
+
source: baseTexture.source,
|
|
90
|
+
// Use the correct source for the Texture constructor
|
|
91
|
+
frame: frameRect
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Create and configure the AnimatedSprite
|
|
97
|
+
const animatedSprite = new pixi_js.AnimatedSprite(frames);
|
|
98
|
+
animatedSprite.animationSpeed = 0.25; // Faster speed for more visible animation
|
|
99
|
+
animatedSprite.loop = true;
|
|
100
|
+
animatedSprite.scale.set(0.4);
|
|
101
|
+
animatedSprite.anchor.set(0.5, 0.5);
|
|
102
|
+
|
|
103
|
+
// Center the sprite in the canvas
|
|
104
|
+
animatedSprite.x = this.appRef.current.renderer.width / 2;
|
|
105
|
+
animatedSprite.y = this.appRef.current.renderer.height / 2;
|
|
106
|
+
this.appRef.current.stage.addChild(animatedSprite);
|
|
107
|
+
animatedSprite.play();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
RightThunder
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const useLightening = () => {
|
|
117
|
+
class Lightening {
|
|
118
|
+
constructor(cards, spritePath, appRef) {
|
|
119
|
+
this.cards = cards;
|
|
120
|
+
this.spritePath = spritePath;
|
|
121
|
+
this.appRef = appRef;
|
|
122
|
+
this.initiateAnimation();
|
|
123
|
+
}
|
|
124
|
+
async initiateAnimation() {
|
|
125
|
+
// Create a container to hold all animatedSprites
|
|
126
|
+
const {
|
|
127
|
+
Container
|
|
128
|
+
} = await import('pixi.js');
|
|
129
|
+
const cardsContainer = new Container();
|
|
130
|
+
|
|
131
|
+
// Calculate layout: arrange cards horizontally, centered
|
|
132
|
+
const numCards = this.cards.length;
|
|
133
|
+
const spacing = 77.6 * 0.5 + 20; // space between cards, adjust as needed
|
|
134
|
+
const spriteScale = 0.3;
|
|
135
|
+
this.appRef.current.renderer.height / 2;
|
|
136
|
+
|
|
137
|
+
// We'll keep track of all sprite promises to add them after all loaded
|
|
138
|
+
const spritePromises = this.cards.map(async (card, i) => {
|
|
139
|
+
var _baseTexture$resource, _baseTexture$resource2, _card$multiplier, _card$suit;
|
|
140
|
+
const baseTexture = await pixi_js.Assets.load(this.spritePath);
|
|
141
|
+
|
|
142
|
+
// Prepare frames for animation
|
|
143
|
+
const frames = [];
|
|
144
|
+
const texWidth = ((_baseTexture$resource = baseTexture.resource) === null || _baseTexture$resource === void 0 ? void 0 : _baseTexture$resource.width) || baseTexture.width;
|
|
145
|
+
const texHeight = ((_baseTexture$resource2 = baseTexture.resource) === null || _baseTexture$resource2 === void 0 ? void 0 : _baseTexture$resource2.height) || baseTexture.height;
|
|
146
|
+
const columns = 10;
|
|
147
|
+
const rows = 3;
|
|
148
|
+
const frameWidth = texWidth / columns;
|
|
149
|
+
const frameHeight = texHeight / rows;
|
|
150
|
+
for (let row = 0; row < rows; row++) {
|
|
151
|
+
for (let col = 0; col < columns; col++) {
|
|
152
|
+
const x = col * frameWidth;
|
|
153
|
+
const y = row * frameHeight;
|
|
154
|
+
const frameRect = new pixi_js.Rectangle(x, y, frameWidth, frameHeight);
|
|
155
|
+
frames.push(new pixi_js.Texture({
|
|
156
|
+
source: baseTexture.source,
|
|
157
|
+
frame: frameRect
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Create and configure the AnimatedSprite
|
|
163
|
+
const animatedSprite = new pixi_js.AnimatedSprite(frames);
|
|
164
|
+
animatedSprite.animationSpeed = 0.25;
|
|
165
|
+
animatedSprite.loop = true;
|
|
166
|
+
animatedSprite.scale.set(spriteScale);
|
|
167
|
+
animatedSprite.anchor.set(0.5);
|
|
168
|
+
animatedSprite.allowChildren = true;
|
|
169
|
+
|
|
170
|
+
// Position horizontally, centered
|
|
171
|
+
const totalWidth = (numCards - 1) * spacing;
|
|
172
|
+
animatedSprite.x = -totalWidth / 2 + i * spacing;
|
|
173
|
+
animatedSprite.y = 0; // Centered in container
|
|
174
|
+
|
|
175
|
+
animatedSprite.play();
|
|
176
|
+
|
|
177
|
+
// Add multiplier text
|
|
178
|
+
const multiplier_txt = new pixi_js.Text({
|
|
179
|
+
text: `${(_card$multiplier = card.multiplier) !== null && _card$multiplier !== void 0 ? _card$multiplier : card.multplier}x`,
|
|
180
|
+
style: {
|
|
181
|
+
fontSize: 75,
|
|
182
|
+
fontWeight: "bold",
|
|
183
|
+
fill: 0xffd700,
|
|
184
|
+
align: "center"
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
multiplier_txt.anchor.set(0.5);
|
|
188
|
+
multiplier_txt.position.set(0, -50);
|
|
189
|
+
animatedSprite.addChild(multiplier_txt);
|
|
190
|
+
|
|
191
|
+
// Suit icon
|
|
192
|
+
let suit_url = "";
|
|
193
|
+
switch ((_card$suit = card.suit) === null || _card$suit === void 0 ? void 0 : _card$suit.toLowerCase()) {
|
|
194
|
+
case "hearts":
|
|
195
|
+
suit_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f0/SuitHearts.svg/60px-SuitHearts.svg.png";
|
|
196
|
+
break;
|
|
197
|
+
case "clubs":
|
|
198
|
+
suit_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8a/SuitClubs.svg/60px-SuitClubs.svg.png";
|
|
199
|
+
break;
|
|
200
|
+
case "diamonds":
|
|
201
|
+
suit_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/d/db/SuitDiamonds.svg/60px-SuitDiamonds.svg.png";
|
|
202
|
+
break;
|
|
203
|
+
default:
|
|
204
|
+
suit_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/5/5b/SuitSpades.svg/60px-SuitSpades.svg.png";
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Load and add suit sprite
|
|
209
|
+
const card_suit_tex = await pixi_js.Assets.load(suit_url);
|
|
210
|
+
const card_suit_sprite = new pixi_js.Sprite(card_suit_tex);
|
|
211
|
+
card_suit_sprite.anchor.set(0.5);
|
|
212
|
+
card_suit_sprite.scale.set(1.2);
|
|
213
|
+
card_suit_sprite.position.set(0, 35);
|
|
214
|
+
animatedSprite.addChild(card_suit_sprite);
|
|
215
|
+
return animatedSprite;
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// After all sprites are loaded, add them to the container and stage
|
|
219
|
+
Promise.all(spritePromises).then(sprites => {
|
|
220
|
+
sprites.forEach(sprite => cardsContainer.addChild(sprite));
|
|
221
|
+
// Center the container in the canvas
|
|
222
|
+
cardsContainer.x = this.appRef.current.renderer.width / 2;
|
|
223
|
+
cardsContainer.y = this.appRef.current.renderer.height / 2;
|
|
224
|
+
this.appRef.current.stage.addChild(cardsContainer);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
Lightening
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
// CSS is provided separately via the style field in package.json
|
|
234
|
+
|
|
235
|
+
const thunder_left = "https://babylonbetst.evo-games.com/frontend/evo/mini/images/lightnings.f9848fb7.webp";
|
|
236
|
+
const thunder_right = "https://babylonbetst.evo-games.com/frontend/evo/mini/images/lightnings.aeaa062e.webp";
|
|
237
|
+
const border_loop = "https://babylonbetst.evo-games.com/frontend/evo/mini/images/borderloop.c55570cc.webp";
|
|
238
|
+
const LighteningCard = ({
|
|
239
|
+
roundStatus,
|
|
240
|
+
cards
|
|
241
|
+
}) => {
|
|
242
|
+
const containerRef = React.useRef(null);
|
|
243
|
+
const appRef = React.useRef(null);
|
|
244
|
+
const {
|
|
245
|
+
LeftThunder
|
|
246
|
+
} = useLeftThunder();
|
|
247
|
+
const {
|
|
248
|
+
RightThunder
|
|
249
|
+
} = useRightThunder();
|
|
250
|
+
const {
|
|
251
|
+
Lightening
|
|
252
|
+
} = useLightening();
|
|
253
|
+
const initiatePixiApplication = async () => {
|
|
254
|
+
appRef.current = new pixi_js.Application();
|
|
255
|
+
await appRef.current.init({
|
|
256
|
+
resizeTo: containerRef.current,
|
|
257
|
+
backgroundAlpha: 0,
|
|
258
|
+
powerPreference: "high-performance",
|
|
259
|
+
resolution: window.devicePixelRatio || 1,
|
|
260
|
+
autoDensity: true // This ensures the canvas CSS size is correct
|
|
261
|
+
});
|
|
262
|
+
containerRef.current.appendChild(appRef.current.canvas);
|
|
263
|
+
globalThis.__PIXI_APP__ = appRef.current;
|
|
264
|
+
roundStatus === "NO_MORE_BETS" && new LeftThunder(thunder_left, appRef);
|
|
265
|
+
roundStatus === "NO_MORE_BETS" && new RightThunder(thunder_right, appRef);
|
|
266
|
+
roundStatus === "LIGHTNING" && new Lightening(cards, border_loop, appRef);
|
|
267
|
+
["NEW_CARD", "ROUND_END", "BETTING_STARTED"].includes(roundStatus) && new Lightening(cards, border_loop, appRef);
|
|
268
|
+
};
|
|
269
|
+
React.useEffect(() => {
|
|
270
|
+
if (!containerRef.current) return;
|
|
271
|
+
initiatePixiApplication();
|
|
272
|
+
// Cleanup function
|
|
273
|
+
return () => {
|
|
274
|
+
if (appRef.current) {
|
|
275
|
+
var _appRef$current;
|
|
276
|
+
(_appRef$current = appRef.current) === null || _appRef$current === void 0 || _appRef$current.destroy(true);
|
|
277
|
+
appRef.current = null;
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
}, [roundStatus]);
|
|
281
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
282
|
+
className: "lightening-card",
|
|
283
|
+
ref: containerRef
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
LighteningCard.propTypes = {
|
|
287
|
+
roundStatus: PropTypes.string.isRequired,
|
|
288
|
+
cards: PropTypes.arrayOf(PropTypes.shape({
|
|
289
|
+
multiplier: PropTypes.number,
|
|
290
|
+
rank: PropTypes.string,
|
|
291
|
+
suit: PropTypes.string
|
|
292
|
+
})),
|
|
293
|
+
assetPath: PropTypes.string,
|
|
294
|
+
// Path to the animation asset
|
|
295
|
+
onAnimationReady: PropTypes.func // Callback when animation is ready
|
|
296
|
+
};
|
|
297
|
+
LighteningCard.defaultProps = {
|
|
298
|
+
cards: []
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
module.exports = LighteningCard;
|
|
302
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/hooks/useLeftThunder.js","../src/hooks/useRightThunder.js","../src/hooks/useLightening.js","../src/LighteningCard.js"],"sourcesContent":["import { AnimatedSprite, Assets, Rectangle, Texture } from \"pixi.js\";\r\n\r\nconst useLeftThunder = () => {\r\n class LeftThunder {\r\n constructor(spritePath, appRef) {\r\n this.spritePath = spritePath;\r\n this.appRef = appRef;\r\n this.initiateAnimation();\r\n }\r\n\r\n async initiateAnimation() {\r\n Assets.load(this.spritePath).then((baseTexture) => {\r\n // Ensure the animation is visible and sized correctly\r\n const frames = [];\r\n // Get the correct texture dimensions\r\n const texWidth = baseTexture.resource?.width || baseTexture.width;\r\n const texHeight = baseTexture.resource?.height || baseTexture.height;\r\n\r\n const columns = 3;\r\n const rows = 10;\r\n\r\n const frameWidth = texWidth / columns;\r\n const frameHeight = texHeight / rows;\r\n\r\n // Row-major order: for each row, for each column\r\n for (let row = 0; row < rows; row++) {\r\n for (let col = 0; col < columns; col++) {\r\n const x = col * frameWidth;\r\n const y = row * frameHeight;\r\n const frameRect = new Rectangle(x, y, frameWidth, frameHeight);\r\n frames.push(\r\n new Texture({\r\n source: baseTexture.source, // Use the correct source for the Texture constructor\r\n frame: frameRect,\r\n })\r\n );\r\n }\r\n }\r\n\r\n // Create and configure the AnimatedSprite\r\n const animatedSprite = new AnimatedSprite(frames);\r\n animatedSprite.animationSpeed = 0.25; // Faster speed for more visible animation\r\n animatedSprite.loop = true;\r\n animatedSprite.scale.set(0.4);\r\n animatedSprite.anchor.set(0.5, 0.5);\r\n\r\n // Center the sprite in the canvas\r\n animatedSprite.x = this.appRef.current.renderer.width / 2;\r\n animatedSprite.y = this.appRef.current.renderer.height / 2;\r\n\r\n this.appRef.current.stage.addChild(animatedSprite);\r\n animatedSprite.play();\r\n });\r\n }\r\n }\r\n\r\n return {\r\n LeftThunder,\r\n };\r\n};\r\n\r\nexport default useLeftThunder;\r\n","import { AnimatedSprite, Assets, Rectangle, Texture } from \"pixi.js\";\r\n\r\nconst useRightThunder = () => {\r\n class RightThunder {\r\n constructor(spritePath, appRef) {\r\n this.spritePath = spritePath;\r\n this.appRef = appRef;\r\n this.initiateAnimation();\r\n }\r\n\r\n async initiateAnimation() {\r\n Assets.load(this.spritePath).then((baseTexture) => {\r\n // Ensure the animation is visible and sized correctly\r\n const frames = [];\r\n\r\n // Get the correct texture dimensions\r\n const texWidth = baseTexture.resource?.width || baseTexture.width;\r\n const texHeight = baseTexture.resource?.height || baseTexture.height;\r\n\r\n const columns = 3;\r\n const rows = 10;\r\n\r\n const frameWidth = texWidth / columns;\r\n const frameHeight = texHeight / rows;\r\n\r\n // Row-major order: for each row, for each column\r\n for (let row = 0; row < rows; row++) {\r\n for (let col = 0; col < columns; col++) {\r\n const x = col * frameWidth;\r\n const y = row * frameHeight;\r\n const frameRect = new Rectangle(x, y, frameWidth, frameHeight);\r\n frames.push(\r\n new Texture({\r\n source: baseTexture.source, // Use the correct source for the Texture constructor\r\n frame: frameRect,\r\n })\r\n );\r\n }\r\n }\r\n\r\n // Create and configure the AnimatedSprite\r\n const animatedSprite = new AnimatedSprite(frames);\r\n animatedSprite.animationSpeed = 0.25; // Faster speed for more visible animation\r\n animatedSprite.loop = true;\r\n animatedSprite.scale.set(0.4);\r\n animatedSprite.anchor.set(0.5, 0.5);\r\n\r\n // Center the sprite in the canvas\r\n animatedSprite.x = this.appRef.current.renderer.width / 2;\r\n animatedSprite.y = this.appRef.current.renderer.height / 2;\r\n\r\n this.appRef.current.stage.addChild(animatedSprite);\r\n animatedSprite.play();\r\n });\r\n }\r\n }\r\n return { RightThunder };\r\n};\r\n\r\nexport default useRightThunder;\r\n","import {\r\n AnimatedSprite,\r\n Assets,\r\n Rectangle,\r\n Text,\r\n Texture,\r\n Sprite,\r\n Graphics,\r\n} from \"pixi.js\";\r\nimport { useEffect, useRef } from \"react\";\r\n\r\nconst useLightening = () => {\r\n class Lightening {\r\n constructor(cards, spritePath, appRef) {\r\n this.cards = cards;\r\n this.spritePath = spritePath;\r\n this.appRef = appRef;\r\n this.initiateAnimation();\r\n }\r\n\r\n async initiateAnimation() {\r\n // Create a container to hold all animatedSprites\r\n const { Container } = await import(\"pixi.js\");\r\n const cardsContainer = new Container();\r\n\r\n // Calculate layout: arrange cards horizontally, centered\r\n const numCards = this.cards.length;\r\n const spacing = 77.6 * 0.5 + 20; // space between cards, adjust as needed\r\n const spriteScale = 0.3;\r\n const baseY = this.appRef.current.renderer.height / 2;\r\n\r\n // We'll keep track of all sprite promises to add them after all loaded\r\n const spritePromises = this.cards.map(async (card, i) => {\r\n const baseTexture = await Assets.load(this.spritePath);\r\n\r\n // Prepare frames for animation\r\n const frames = [];\r\n const texWidth = baseTexture.resource?.width || baseTexture.width;\r\n const texHeight = baseTexture.resource?.height || baseTexture.height;\r\n const columns = 10;\r\n const rows = 3;\r\n const frameWidth = texWidth / columns;\r\n const frameHeight = texHeight / rows;\r\n\r\n for (let row = 0; row < rows; row++) {\r\n for (let col = 0; col < columns; col++) {\r\n const x = col * frameWidth;\r\n const y = row * frameHeight;\r\n const frameRect = new Rectangle(x, y, frameWidth, frameHeight);\r\n frames.push(\r\n new Texture({\r\n source: baseTexture.source,\r\n frame: frameRect,\r\n })\r\n );\r\n }\r\n }\r\n\r\n // Create and configure the AnimatedSprite\r\n const animatedSprite = new AnimatedSprite(frames);\r\n animatedSprite.animationSpeed = 0.25;\r\n animatedSprite.loop = true;\r\n animatedSprite.scale.set(spriteScale);\r\n animatedSprite.anchor.set(0.5);\r\n animatedSprite.allowChildren = true;\r\n\r\n // Position horizontally, centered\r\n const totalWidth = (numCards - 1) * spacing;\r\n animatedSprite.x = -totalWidth / 2 + i * spacing;\r\n animatedSprite.y = 0; // Centered in container\r\n\r\n animatedSprite.play();\r\n\r\n // Add multiplier text\r\n const multiplier_txt = new Text({\r\n text: `${card.multiplier ?? card.multplier}x`,\r\n style: {\r\n fontSize: 75,\r\n fontWeight: \"bold\",\r\n fill: 0xffd700,\r\n align: \"center\",\r\n },\r\n });\r\n multiplier_txt.anchor.set(0.5);\r\n multiplier_txt.position.set(0, -50);\r\n animatedSprite.addChild(multiplier_txt);\r\n\r\n // Suit icon\r\n let suit_url = \"\";\r\n switch (card.suit?.toLowerCase()) {\r\n case \"hearts\":\r\n suit_url =\r\n \"https://upload.wikimedia.org/wikipedia/commons/thumb/f/f0/SuitHearts.svg/60px-SuitHearts.svg.png\";\r\n break;\r\n case \"clubs\":\r\n suit_url =\r\n \"https://upload.wikimedia.org/wikipedia/commons/thumb/8/8a/SuitClubs.svg/60px-SuitClubs.svg.png\";\r\n break;\r\n case \"diamonds\":\r\n suit_url =\r\n \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/db/SuitDiamonds.svg/60px-SuitDiamonds.svg.png\";\r\n break;\r\n default:\r\n suit_url =\r\n \"https://upload.wikimedia.org/wikipedia/commons/thumb/5/5b/SuitSpades.svg/60px-SuitSpades.svg.png\";\r\n break;\r\n }\r\n\r\n // Load and add suit sprite\r\n const card_suit_tex = await Assets.load(suit_url);\r\n const card_suit_sprite = new Sprite(card_suit_tex);\r\n card_suit_sprite.anchor.set(0.5);\r\n card_suit_sprite.scale.set(1.2);\r\n card_suit_sprite.position.set(0, 35);\r\n animatedSprite.addChild(card_suit_sprite);\r\n\r\n return animatedSprite;\r\n });\r\n\r\n // After all sprites are loaded, add them to the container and stage\r\n Promise.all(spritePromises).then((sprites) => {\r\n sprites.forEach((sprite) => cardsContainer.addChild(sprite));\r\n // Center the container in the canvas\r\n cardsContainer.x = this.appRef.current.renderer.width / 2;\r\n cardsContainer.y = this.appRef.current.renderer.height / 2;\r\n this.appRef.current.stage.addChild(cardsContainer);\r\n });\r\n }\r\n }\r\n\r\n return {\r\n Lightening,\r\n };\r\n};\r\n\r\nexport default useLightening;\r\n","import React, { useEffect, useRef } from \"react\";\r\nimport PropTypes from \"prop-types\";\r\nimport { Application } from \"pixi.js\";\r\nimport useLeftThunder from \"./hooks/useLeftThunder\";\r\nimport useRightThunder from \"./hooks/useRightThunder\";\r\nimport useLightening from \"./hooks/useLightening\";\r\nimport \"./LighteningCard.css\";\r\n\r\n// CSS is provided separately via the style field in package.json\r\n\r\nconst thunder_left =\r\n \"https://babylonbetst.evo-games.com/frontend/evo/mini/images/lightnings.f9848fb7.webp\";\r\nconst thunder_middle =\r\n \"https://babylonbetst.evo-games.com/frontend/evo/mini/images/lightnings.88df6be3.webp\";\r\nconst thunder_right =\r\n \"https://babylonbetst.evo-games.com/frontend/evo/mini/images/lightnings.aeaa062e.webp\";\r\n\r\nconst border_start =\r\n \"https://babylonbetst.evo-games.com/frontend/evo/mini/images/borderstar.65180209.webp\";\r\nconst border_loop =\r\n \"https://babylonbetst.evo-games.com/frontend/evo/mini/images/borderloop.c55570cc.webp\";\r\n\r\nconst LighteningCard = ({ roundStatus, cards }) => {\r\n const containerRef = useRef(null);\r\n const appRef = useRef(null);\r\n const { LeftThunder } = useLeftThunder();\r\n const { RightThunder } = useRightThunder();\r\n const { Lightening } = useLightening();\r\n\r\n const initiatePixiApplication = async () => {\r\n appRef.current = new Application();\r\n await appRef.current.init({\r\n resizeTo: containerRef.current,\r\n backgroundAlpha: 0,\r\n powerPreference: \"high-performance\",\r\n resolution: window.devicePixelRatio || 1,\r\n autoDensity: true, // This ensures the canvas CSS size is correct\r\n });\r\n containerRef.current.appendChild(appRef.current.canvas);\r\n globalThis.__PIXI_APP__ = appRef.current;\r\n\r\n roundStatus === \"NO_MORE_BETS\" && new LeftThunder(thunder_left, appRef);\r\n roundStatus === \"NO_MORE_BETS\" && new RightThunder(thunder_right, appRef);\r\n roundStatus === \"LIGHTNING\" && new Lightening(cards, border_loop, appRef);\r\n [\"NEW_CARD\", \"ROUND_END\", \"BETTING_STARTED\"].includes(roundStatus) &&\r\n new Lightening(cards, border_loop, appRef);\r\n };\r\n\r\n useEffect(() => {\r\n if (!containerRef.current) return;\r\n initiatePixiApplication();\r\n // Cleanup function\r\n return () => {\r\n if (appRef.current) {\r\n appRef.current?.destroy(true);\r\n appRef.current = null;\r\n }\r\n };\r\n }, [roundStatus]);\r\n\r\n return <div className=\"lightening-card\" ref={containerRef}></div>;\r\n};\r\n\r\nLighteningCard.propTypes = {\r\n roundStatus: PropTypes.string.isRequired,\r\n cards: PropTypes.arrayOf(\r\n PropTypes.shape({\r\n multiplier: PropTypes.number,\r\n rank: PropTypes.string,\r\n suit: PropTypes.string,\r\n })\r\n ),\r\n assetPath: PropTypes.string, // Path to the animation asset\r\n onAnimationReady: PropTypes.func, // Callback when animation is ready\r\n};\r\n\r\nLighteningCard.defaultProps = {\r\n cards: [],\r\n};\r\n\r\nexport default LighteningCard;\r\n"],"names":["useLeftThunder","LeftThunder","constructor","spritePath","appRef","initiateAnimation","Assets","load","then","baseTexture","_baseTexture$resource","_baseTexture$resource2","frames","texWidth","resource","width","texHeight","height","columns","rows","frameWidth","frameHeight","row","col","x","y","frameRect","Rectangle","push","Texture","source","frame","animatedSprite","AnimatedSprite","animationSpeed","loop","scale","set","anchor","current","renderer","stage","addChild","play","useRightThunder","RightThunder","useLightening","Lightening","cards","Container","cardsContainer","numCards","length","spacing","spriteScale","spritePromises","map","card","i","_card$multiplier","_card$suit","allowChildren","totalWidth","multiplier_txt","Text","text","multiplier","multplier","style","fontSize","fontWeight","fill","align","position","suit_url","suit","toLowerCase","card_suit_tex","card_suit_sprite","Sprite","Promise","all","sprites","forEach","sprite","thunder_left","thunder_right","border_loop","LighteningCard","roundStatus","containerRef","useRef","initiatePixiApplication","Application","init","resizeTo","backgroundAlpha","powerPreference","resolution","window","devicePixelRatio","autoDensity","appendChild","canvas","globalThis","__PIXI_APP__","includes","useEffect","_appRef$current","destroy","React","createElement","className","ref","propTypes","PropTypes","string","isRequired","arrayOf","shape","number","rank","assetPath","onAnimationReady","func","defaultProps"],"mappings":";;;;;;AAEA,MAAMA,cAAc,GAAGA,MAAM;AAC3B,EAAA,MAAMC,WAAW,CAAC;AAChBC,IAAAA,WAAWA,CAACC,UAAU,EAAEC,MAAM,EAAE;MAC9B,IAAI,CAACD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K,EAAEmE,SAAS,CAACG,OAAO,CACtBH,SAAS,CAACI,KAAK,CAAC;IACdrD,UAAU,EAAEiD,SAAS,CAACK,MAAM;IAC5BC,IAAI,EAAEN,SAAS,CAACC,MAAM;IACtBzC,IAAI,EAAEwC,SAAS,CAACC;AAClB,GAAC,CACH,CAAC;EACDM,SAAS,EAAEP,SAAS,CAACC,MAAM;AAAE;AAC7BO,EAAAA,gBAAgB,EAAER,SAAS,CAACS,IAAI;AAClC,CAAC;AAEDpC,cAAc,CAACqC,YAAY,GAAG;AAC5B7E,EAAAA,KAAK,EAAE;AACT,CAAC;;;;"}
|
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["LighteningCard.css"],"names":[],"mappings":"AAAA,iBAEE,iBAAoB,CAMpB,MAAQ,CAJR,eAAgB,CAHhB,cAAe,CAKf,iBAAkB,CAClB,QAAS,CAET,sBAA4B,CAN5B,cAOF,CAEA,yBACE,iBAEE,iBAAoB,CADpB,cAAe,CAEf,cACF,CACF","file":"index.css","sourcesContent":[".lightening-card {\r\n min-width: 15vw;\r\n aspect-ratio: 16 / 9;\r\n z-index: 100000;\r\n margin-top: 2rem;\r\n\r\n position: absolute;\r\n top: 3rem;\r\n left: 0%;\r\n transform: translate(0%, 0%);\r\n}\r\n\r\n@media (max-width: 768px) {\r\n .lightening-card {\r\n min-width: 45vw;\r\n aspect-ratio: 16 / 9;\r\n z-index: 100000;\r\n }\r\n}\r\n"]}
|