-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
149 lines (124 loc) · 4.44 KB
/
index.html
File metadata and controls
149 lines (124 loc) · 4.44 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
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:type" content="website"/>
<meta property="og:site_name" content="64k Scene"/>
<meta property="og:description" content="A curated selection of 64k intros: realtime computer animations in less than 64kB" />
<title>64k Scene | Gallery</title>
<link rel="stylesheet" href="style.css">
<header>
<nav>
<a href="index.html">Gallery</a>
<a href="resources.html">Resources</a>
<a href="about.html">About</a>
</nav>
</header>
<div id="youtube-overlay">
<div id="youtube-player"></div>
</div>
<section>
<div class="card intro">
<p>
The digital art creations below are “64k intros”: small computer programs of 65,536 bytes or less, that present a short
audio visual experience. They are a showcase of creativity and technical skills, using techniques like procedural
generation, sound synthesis, and real-time graphics.
<a href="about.html">More info</a>.
</p>
<p>
All the works presented remain the property of their respective authors.
</p>
<div style="text-align: center;">
<span class="action-link" onclick="sortDate();">Sort by date</span> / <span class="action-link" onclick="sortRandom();">Shuffle</span>
</div>
</div>
<div id="demo-list" class="gallery"></div>
</section>
<script src="./demos.js"></script>
<script>
const youtubeOverlay = document.getElementById("youtube-overlay");
const youtubePlayer = document.getElementById("youtube-player");
const shuffleArray = array => {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
const temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
function showYouTube(id) {
youtubePlayer.innerHTML = `<iframe class="youtube"
src="https://www.youtube.com/embed/${id}" title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen loading="lazy">
</iframe>`;
youtubeOverlay.style.display = "block";
}
const monthStrings = [
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
]
function createCard(data) {
const card = document.createElement("div");
card.className = "card demo";
const img = document.createElement("img");
img.className = "screenshot";
img.src = data.screenshot;
img.setAttribute("loading", "lazy");
img.onclick = () => {
showYouTube(data.youtube);
};
card.appendChild(img);
const details = document.createElement("div");
const infoLink = document.createElement("a");
infoLink.href = "https://www.pouet.net/prod.php?which=" + data.pouet;
const info = document.createElement("img");
info.className = "info";
info.title = "View details on pouet.net";
info.src = "img/information.png";
infoLink.appendChild(info);
details.appendChild(infoLink);
details.className = "details";
const title = document.createElement("h3");
title.innerText = data.title;
details.appendChild(title);
const group = document.createElement("div");
group.className = "group";
group.innerText = "by " + data.group;
details.appendChild(group);
const date = document.createElement("div");
date.className = "date";
const dateArray = data.date.split("-");
const year = dateArray[0];
const month = monthStrings[dateArray[1] - 1];
date.innerText = year;
// pouet database doesn't have the day (https://github.com/pouetnet/pouet2.0/issues/124)
// so we show just the month + year.
date.title = `${month} ${year}`;
details.appendChild(date);
card.appendChild(details);
return card;
}
function updateGallery() {
const demos = document.getElementById("demo-list");
demos.innerHTML = "";
for (const data of allDemos) {
demos.appendChild(createCard(data));
}
}
function sortRandom() {
shuffleArray(allDemos);
updateGallery();
}
function sortDate() {
allDemos.sort((a, b) => {
return a.date < b.date ? 1 : -1;
});
updateGallery();
}
sortRandom();
youtubeOverlay.addEventListener("click", (e) => {
youtubePlayer.innerHTML = "";
youtubeOverlay.style.display = "none";
});
</script>