-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
477 lines (420 loc) · 16.7 KB
/
index.html
File metadata and controls
477 lines (420 loc) · 16.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pixarithm Minted Fragments</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap" rel="stylesheet">
<style>
/* Global Styles */
body {
font-family: 'Orbitron', sans-serif;
color: #f0f0f0;
text-align: center;
padding: 20px;
margin: 0;
overflow-x: hidden;
background: #1a1a1a;
}
canvas#matrix-background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
}
h1 {
font-size: 2rem;
text-shadow: 2px 2px 10px rgba(255, 255, 255, 0.3);
position: relative;
}
/* Gallery Styles */
#gallery-container {
display: flex;
align-items: center;
justify-content: center;
margin: 20px auto;
width: 90%;
max-width: 800px;
overflow: hidden;
position: relative;
height: 160px;
z-index: 1;
}
.gallery-wrapper {
display: flex;
gap: 15px;
transition: transform 0.8s ease-in-out;
justify-content: flex-start;
align-items: center;
height: 100%;
width: 100%;
flex-wrap: nowrap;
}
.gallery-item {
width: 120px;
height: 120px;
object-fit: cover;
border-radius: 10px;
cursor: pointer;
transition: box-shadow 0.3s ease-in-out;
position: relative;
}
.gallery-item:hover {
box-shadow: 0px 0px 20px rgba(0, 255, 255, 0.9);
}
.gallery-nav {
position: absolute;
top: 50%;
transform: translateY(-50%);
background: rgba(255, 255, 255, 0.2);
border: none;
color: white;
font-size: 24px;
cursor: pointer;
padding: 10px;
border-radius: 50%;
transition: background 0.3s;
z-index: 10;
}
.gallery-nav:hover {
background: rgba(255, 255, 255, 0.4);
}
.prev { left: 10px; }
.next { right: 10px; }
/* Chart Styles */
#chart-container {
width: 90%;
max-width: 800px;
height: 600px;
margin: 20px auto;
background: rgba(255, 255, 255, 0.1);
padding: 20px;
border-radius: 12px;
box-shadow: 0px 0px 15px rgba(255, 255, 255, 0.1);
backdrop-filter: blur(5px);
position: relative;
z-index: 1;
}
/* Tooltip Styles */
.tooltip {
position: absolute;
background: rgba(0, 0, 0, 0.8);
color: #fff;
padding: 6px 12px;
font-size: 14px;
border-radius: 6px;
white-space: nowrap;
visibility: hidden;
opacity: 0;
transition: opacity 0.3s ease-in-out;
pointer-events: none;
z-index: 1000;
}
/* Icon Styles */
.icon-container {
display: flex;
justify-content: center;
align-items: center;
gap: 15px;
margin-top: 20px;
position: relative;
z-index: 1;
}
.icon {
width: 30px;
height: 30px;
background-size: contain;
background-repeat: no-repeat;
filter: drop-shadow(0px 0px 5px rgba(173, 216, 230, 0.8));
}
.x-icon {
background-image: url('assets/images/x-icon.png');
}
.asteroid-icon {
background-image: url('assets/images/asteroid-icon.png');
width: 36px;
height: 36px;
}
</style>
</head>
<body>
<!-- Matrix Background Canvas -->
<canvas id="matrix-background"></canvas>
<h1>Pixarithm Minted Fragments</h1>
<div id="tooltip" class="tooltip"></div>
<div id="gallery-container">
<button class="gallery-nav prev" onclick="moveGallery(-1)">❮</button>
<div class="gallery-wrapper" id="gallery-wrapper"></div>
<button class="gallery-nav next" onclick="moveGallery(1)">❯</button>
</div>
<div id="chart-container">
<canvas id="mintedChart"></canvas>
</div>
<div class="icon-container">
<a href="https://x.com/pixaroids" target="_blank" class="icon x-icon"></a>
<a href="https://asteroidprotocol.io/app/launchpad/PIXAROIDS5" target="_blank" class="icon asteroid-icon"></a>
</div>
<script>
// MATRIX BACKGROUND CODE
const matrixCanvas = document.getElementById('matrix-background');
const matrixCtx = matrixCanvas.getContext('2d');
// Pre-define colors to avoid recreation
const darkNeonColors = [
[139, 0, 139], // Dark Magenta
[0, 100, 100], // Dark Cyan
[34, 139, 34], // Dark Green
[128, 0, 128], // Dark Purple
[153, 50, 204], // Dark Orchid
[0, 51, 102] // Dark Blue
];
// Pre-calculate color shades
const colorShades = darkNeonColors.map(baseColor => {
const shades = [];
for (let i = 0; i < 3; i++) {
const factor = 0.4 + (i * 0.2);
shades.push([
Math.floor(baseColor[0] * factor),
Math.floor(baseColor[1] * factor),
Math.floor(baseColor[2] * factor)
]);
}
return shades;
});
const matrixSettings = {
colWidth: 16, // Increased column width for fewer digits.
rowHeight: 16, // Increased row height for fewer digits.
density: 0.4, // Only render a percentage of possible digits.
frameSkip: 2, // Only render every nth frame.
frameCount: 0, // Current frame counter.
alpha: 0.95 // Set global alpha for matrix to be subtle background.
};
let digits = [];
let lastTime = 0;
const FPS_LIMIT = 20; // Lower FPS for background
const FRAME_TIME = 1000 / FPS_LIMIT;
function resizeMatrixCanvas() {
// Only resize if dimensions actually changed
if (matrixCanvas.width !== window.innerWidth || matrixCanvas.height !== window.innerHeight) {
matrixCanvas.width = window.innerWidth;
matrixCanvas.height = window.innerHeight;
initDigits();
}
}
function initDigits() {
digits = [];
const cols = Math.ceil(matrixCanvas.width / matrixSettings.colWidth);
const rows = Math.ceil(matrixCanvas.height / matrixSettings.rowHeight);
for (let x = 0; x < cols; x++) {
const colorIndex = Math.floor(Math.random() * darkNeonColors.length);
const baseColor = darkNeonColors[colorIndex];
const shades = colorShades[colorIndex];
for (let y = 0; y < rows; y++) {
// Only create digits based on density setting
if (Math.random() < matrixSettings.density) {
digits.push({
x: x * matrixSettings.colWidth,
y: y * matrixSettings.rowHeight,
value: Math.random() < 0.5 ? '0' : '1',
color: shades[Math.floor(Math.random() * shades.length)],
speed: 4 + Math.random() * 4,
phase: Math.random() * Math.PI * 2
});
}
}
}
}
function animateMatrix(timestamp) {
// Throttle frame rate
if (timestamp - lastTime < FRAME_TIME) {
requestAnimationFrame(animateMatrix);
return;
}
lastTime = timestamp;
matrixSettings.frameCount++;
// Skip frames for better performance
if (matrixSettings.frameCount % matrixSettings.frameSkip !== 0) {
requestAnimationFrame(animateMatrix);
return;
}
matrixCtx.globalAlpha = matrixSettings.alpha;
matrixCtx.fillStyle = '#1a1a1a';
matrixCtx.fillRect(0, 0, matrixCanvas.width, matrixCanvas.height);
matrixCtx.font = `${matrixSettings.colWidth}px monospace`;
const time = timestamp * 0.001;
// Process digits in chunks for better performance
for (let i = 0; i < digits.length; i++) {
const digit = digits[i];
const opacity = 0.3 + 0.7 * (Math.sin(time * (2 * Math.PI / digit.speed) + digit.phase) * 0.5 + 0.5);
matrixCtx.fillStyle = `rgba(${digit.color[0]}, ${digit.color[1]}, ${digit.color[2]}, ${opacity})`;
matrixCtx.fillText(digit.value, digit.x, digit.y + matrixSettings.rowHeight);
}
requestAnimationFrame(animateMatrix);
}
// Initialize matrix background
function initMatrixBackground() {
resizeMatrixCanvas();
requestAnimationFrame(animateMatrix);
// Debounce resize event
let resizeTimeout;
window.addEventListener('resize', () => {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(resizeMatrixCanvas, 250);
});
}
// ORIGINAL WEBSITE CODE
const galleryContainer = document.getElementById('gallery-container');
const galleryWrapper = document.getElementById('gallery-wrapper');
const chartContainer = document.getElementById('chart-container');
const tooltip = document.getElementById('tooltip');
let galleryIndex = 0;
let galleryImages = [];
// Fetch data from API
async function fetchData() {
const query = `
query {
inscription(where: { collection: { symbol: { _eq: "PIXAROIDS5" } } }) {
metadata(path: "$.metadata.name")
transaction{hash}
content_path
current_owner
}
}
`;
const response = await fetch("https://new-api.asteroidprotocol.io/v1/graphql", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ query })
});
const result = await response.json();
const inscriptions = result.data.inscription;
// Process inscriptions data
galleryImages = inscriptions.map(i => ({
image: i.content_path,
link: `https://asteroidprotocol.io/app/inscription/${i.transaction.hash}`,
name: i.metadata
}));
// Update gallery
updateGallery();
// Process data for chart
const counts = {};
const owners = {};
inscriptions.forEach(i => {
const match = i.metadata.match(/^(.*?) Fragment \d+$/);
if (match) {
const name = match[1];
counts[name] = (counts[name] || 0) + 1;
if (!owners[name]) owners[name] = {};
owners[name][i.current_owner] = (owners[name][i.current_owner] || 0) + 1;
}
});
const totalMinted = Object.values(counts).reduce((sum, value) => sum + value, 0);
const totalFragments = 152;
const sortedData = Object.entries(counts)
.map(([name, count]) => ({ Pixarithm: name, Minted: count }))
.sort((a, b) => a.Pixarithm.localeCompare(b.Pixarithm));
const labels = sortedData.map(item => item.Pixarithm);
const data = sortedData.map(item => item.Minted);
const backgroundColors = labels.map(name => {
return counts[name] === 4 && Object.keys(owners[name]).length === 1 ? "rgba(0, 255, 0, 0.7)" : "rgba(173, 216, 230, 0.7)";
});
// Create chart
const ctx = document.getElementById("mintedChart").getContext("2d");
new Chart(ctx, {
type: "bar",
data: {
labels: labels,
datasets: [{
label: `Fragments Minted (${totalMinted}/${totalFragments})`,
data: data,
backgroundColor: backgroundColors,
borderColor: "rgba(173, 216, 230, 1)",
borderWidth: 2,
borderRadius: 5,
hoverBackgroundColor: "rgba(138, 43, 226, 0.7)"
}]
},
options: {
indexAxis: 'y',
responsive: true,
maintainAspectRatio: false,
plugins: {
tooltip: {
callbacks: {
label: function(tooltipItem) {
const pixarithName = labels[tooltipItem.dataIndex];
const ownerList = owners[pixarithName] ? Object.entries(owners[pixarithName]).map(([owner, count]) => `${count} - ${owner}`).join("\n") : "No owners found";
return ownerList.split("\n");
}
}
}
},
scales: {
x: {
title: { display: true, text: "Fragments Minted", font: { size: 14, weight: 'bold' } },
min: 0,
max: 5,
ticks: { stepSize: 1 }
},
y: { title: { display: true, text: "Pixarithm Name", font: { size: 14, weight: 'bold' } } }
}
}
});
}
// Update gallery
function updateGallery() {
galleryWrapper.innerHTML = "";
galleryWrapper.style.width = "100%";
galleryImages.forEach(img => {
const a = document.createElement("a");
a.href = img.link;
a.target = "_blank";
const imgElem = document.createElement("img");
imgElem.src = img.image;
imgElem.classList.add("gallery-item");
imgElem.setAttribute("data-name", img.name);
a.appendChild(imgElem);
galleryWrapper.appendChild(a);
});
galleryWrapper.style.transform = `translateX(${galleryIndex * -140}px)`;
attachTooltipEvents();
}
// Move gallery
function moveGallery(step) {
const maxIndex = galleryImages.length - 5;
galleryIndex = Math.min(Math.max(galleryIndex + step, 0), maxIndex);
galleryWrapper.style.transform = `translateX(${galleryIndex * -140}px)`;
}
// Attach tooltip events
function attachTooltipEvents() {
document.querySelectorAll(".gallery-item").forEach(item => {
item.addEventListener("mouseenter", (event) => {
const name = event.target.getAttribute("data-name");
if (name) {
tooltip.innerText = name;
tooltip.style.left = `${event.clientX}px`;
tooltip.style.top = `${event.clientY - 40}px`;
tooltip.style.visibility = "visible";
tooltip.style.opacity = "1";
}
});
item.addEventListener("mousemove", (event) => {
tooltip.style.left = `${event.clientX + 10}px`;
tooltip.style.top = `${event.clientY - 40}px`;
});
item.addEventListener("mouseleave", () => {
tooltip.style.visibility = "hidden";
tooltip.style.opacity = "0";
});
});
}
// Initialize everything on window load
window.onload = function() {
initMatrixBackground();
fetchData();
};
</script>
</body>
</html>