-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
391 lines (358 loc) · 13.3 KB
/
index.js
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
const c = document.getElementById("canvas")
const ctx = c.getContext("2d")
var x = 0
var y = 0
var w = 0
var h = 0
var animationFrameHandle = 0
var then = Date.now()
const fps = 5
const fpsInterval = 1000 / fps
const cellSize = 10
var cells = []
class Cell {
constructor(x, y) {
this.x = x
this.y = y
this.alive = Math.random() > 0.85
this.nextAlive = false
this.age = 0
}
static get(x, y) {
const i = x + (y * Math.ceil(w / cellSize))
return cells[i]
}
static isAlive(x, y) {
const i = x + (y * Math.ceil(w / cellSize))
if (i < 0 || i >= cells.length) {
return false
}
return cells[i].alive ? 1 : 0
}
update() {
const x = this.x
const y = this.y
const numAlive = Cell.isAlive(x - 1, y - 1) +
Cell.isAlive(x, y - 1) +
Cell.isAlive(x + 1, y - 1) +
Cell.isAlive(x - 1, y) +
Cell.isAlive(x + 1, y) +
Cell.isAlive(x - 1, y + 1) +
Cell.isAlive(x, y + 1) +
Cell.isAlive(x + 1, y + 1)
if (numAlive == 2) {
this.age++
this.nextAlive = this.alive
} else if (numAlive == 3) {
this.nextAlive = true
this.age = 0
} else {
this.age++
this.nextAlive = false
}
}
draw() {
this.alive = this.nextAlive
const beingHovered = x == this.x && y == this.y
if (this.alive || beingHovered) {
ctx.fillStyle = `rgba(169, 186, 164, ${Math.max(0, Math.pow(Math.E, -this.age / 2)) / 6})`
ctx.fillRect(this.x * cellSize, this.y * cellSize, cellSize, cellSize)
// ctx.beginPath()
// ctx.arc(this.x - cellSize + cellSize / 2, this.y * cellSize + cellSize / 2, cellSize / 2, 0, 2 * Math.PI, false)
// ctx.fill()
}
}
}
function gameloop() {
window.requestAnimationFrame(gameloop)
const now = Date.now()
const elapsed = now - then
// if enough time has elapsed, draw the next frame
if (elapsed > fpsInterval) {
then = now - (elapsed % fpsInterval)
// draw frame
ctx.clearRect(0, 0, c.width, c.height)
for (const c of cells) {
c.update()
}
for (const c of cells) {
c.draw()
}
}
}
var windowWidth = 0
function redrawCanvas() {
if (window.innerWidth != windowWidth) {
windowWidth = window.innerWidth
w = Math.ceil(c.offsetWidth)
ctx.canvas.width = w
h = Math.ceil(c.offsetHeight)
ctx.canvas.height = h
if (animationFrameHandle) {
cancelAnimationFrame(animationFrameHandle)
}
cells = []
for (let y = 0; y < Math.ceil(h / cellSize); y++) {
for (let x = 0; x < Math.ceil(w / cellSize); x++) {
cells.push(new Cell(x, y))
}
}
animationFrameHandle = window.requestAnimationFrame(gameloop)
}
}
function manuallySpawnCell(x, y) {
const cell = Cell.get(x, y)
cell.alive = true
cell.age = 0
cell.draw()
cell.alive = true
}
document.getElementById("context-pane").addEventListener("mousemove", function(e) {
const bounds = c.getBoundingClientRect()
x = Math.round((event.clientX - bounds.left) / cellSize) - 1
y = Math.round((event.clientY - bounds.top) / cellSize)
manuallySpawnCell(x, y)
})
redrawCanvas()
window.addEventListener('resize', redrawCanvas)
// artifact about
const artifactAbout = document.getElementById("artifact-about")
const artifactAboutText = createTelescopicTextFromBulletedList(`
- We
- believe in the value of speculative, experimental work that expands the bounds of collective possibility, imagination, and agency.
- aim to develop artifacts that combine philosophical and cultural work alongside technical tooling and infrastructure to advocate for new digital norms and practices. The majority of our work falls into these three (non-exclusive) categories:
- <ol><li>Artifacts as tools and infrastructure</li><li>Artifacts as statements</li><li>Artifacts as play or art</li></ol>
`, {
htmlContainerTag: "div",
textMode: "html",
})
artifactAbout.appendChild(artifactAboutText)
// drops rendering
const artifactList = document.getElementById("artifact-list")
const drops = [
{
id: "declaration",
name: "A Declaration of the Interdependence of Cyberspace",
date: "11/08/2021",
links: [
{
title: "Site",
href: "https://www.interdependence.online/declaration",
},
{
title: "Source (frontend)",
href: "https://github.com/verses-xyz/interdependence-web",
},
{
title: "Source (server)",
href: "https://github.com/verses-xyz/interdependence-server",
}
],
context: `
- We want not just independence, but
- interdependence.
- interdependence. Today we sit at another inflection point in the trajectory of the web.
- This work was precipitated by Facebook's rebranding as Meta, & is a direct fork of Barlow's Declaration,
- a foundational cyberpunk text.
- which describes dreams for a freer cyberspace, but today we find his document insufficient.
- We're interested in the poetics of infrastructure, or how the different parts of a software object come together and produce effects on the viewer.
- Viewers are able to either
- sign
- sign (A signature is not removable. It's an alliance with the values, infrastructure, and labour behind the piece)
- or
- fork
- fork (A fork is a productive step forward, a defining of an alternate vision)
- the
- declaration.
- declaration, all of which lives on
- Arweave.
- Arweave. We wanted to show the beauty of a non-financial use of blockchain, & also ensure that the experience was accessible.
- This work is authorless because it is authored in the spiritual sense by
- many more people than we could feasibly name.
- many more than we could name here. We owe debts to communities that we are part of, teachers who have guided us, and ancestors in various lineages that we now steward.`
},
{
id: "pluriverse",
name: "Pluriverse",
date: "02/09/2022",
links: [
{
title: "Site",
href: "https://pluriverse.world/"
},
{
title: "Source",
href: "https://github.com/verses-xyz/pluriverse"
}
],
context: `
- The Pluriverse artifact is a call to imagine, steward, and create a digital
- pluriverse.
- pluriverse: a world in which many worlds may fit. We offer this work as a values-laden alternative to the Metaverse. We imagine a transition from the monocultures and monopolies of the present to a flowering of worlds and possibilities.
- We see the digital pluriverse as a space of regenerative scale and co-creation, that can challenge illegitimate power through a mosaic of communal, alternative, and autonomous cultural and economic worlds.
- The pluriverse is a
- collaborative project.
- collaborative project; our hope is to provide the beginnings of an architecture that may facilitate and support this process of co-constitution.
- For this, we turn to
- pattern languages.
- pattern languages: modular, structured without prescription, and targeted towards practical design.
- We are excited about the potential of these pattern languages for enabling communities to define their own values in ways that are participatory, repairable, maintainable, and evolving, and to apply principles to concrete organizational and technological decisions.
- We invite you and others to plant and garden these seeds, so that this language may
- grow.
- grow, evolving through intention and use, like all living languages.
- We hope this may lay the groundwork for building tangible instantiations of a shared pluriversal vision.
`
},
{
id: "poems",
name: "Shapeshifting Poetry",
date: "04/26/2022",
links: [
{
title: "Site",
href: "https://poems.verses.xyz/"
},
{
title: "Source",
href: "https://github.com/verses-xyz/poems"
}
],
context: `
- This is a living library of
- shapeshifting
- transforming
- morphing
- evolving
- verses, created by the verses community because
- we wanted to explore mediums for
- software poetry.
- software that allows for different kinds of poetry.
- software that enables different kinds of beauty.
- poems and art and technology and different combinations thereof.
- creating beautiful technology.
- creating beautiful things with beautiful people :)
- These poems are written using a technique called telescopic text which initially was done for a very functional reason, allowing writers to display a high-level summary for more context that dynamically appears as the user desires, a form of in-line footnotes.
- But what about text that changes for the sole purpose of changing, or for purely poetic reasons?
- How does meaning shift as the text changes with engagement?
- How can the reader create, and choose, their own meaning as they explore in the textual landscape?
- Most interestingly, how would this new affordance shape what kinds of verses people feel moved to, and able to, write?
`
},
{
id: "constitutions",
name: "Constitutions of Web3",
date: "06/11/2022",
links: [
{
title: "Site",
href: "https://constitutions.metagov.org/"
},
{
title: "Source",
href: "https://github.com/verses-xyz/constitutions"
}
],
context: `
- Although smart contracts are promising new tools for governance, they alone cannot govern communities; traditional constitutions and declarations of rights are still crucial for good governance.
- In collaboration with Metagov, this artifact is an
- essay,
- analysis of constitutional documents which examines professed rights and values and places DAO constitutions in context wtih digital constitutions more broadly,
- dataset,
- a dataset of various DAO constitutions,
- guide,
- guide which contains recommendations for beginning to draft constitutions,
- and template.
- and
- and, when combined with the guide and our data set of constitutions, will serve as a
- template for creating constitutions.
`
}
]
drops.forEach(drop => {
const dropDiv = document.createElement("li")
dropDiv.id = `drop_${drop.id}`
dropDiv.classList.add("drop")
const date = document.createElement("p")
date.classList.add("date")
date.innerText = drop.date
dropDiv.appendChild(date)
// slightly hacky way to indent all by one and add a 'Read more'
const context = createTelescopicTextFromBulletedList(`
- <h3>${drop.name}</h3>
- <h3>${drop.name}</h3>
${drop.context.replace(/- /g, ' - ')}
`, {
textMode: "html"
})
dropDiv.appendChild(context)
drop.links.forEach(l => {
const link = document.createElement("a")
link.href = l.href
link.innerHTML = `${l.title} ↗`
dropDiv.appendChild(link)
})
artifactList.appendChild(dropDiv)
})
// render main content
const aboutVerse = `
- *Verses* aims to
- be a persistent institution dedicated to articulating visions for a flourishing collective future.
- contribute to a clearer set of technologies, infrastructures, institutions, and processes that realize the ethic of the pluriverse in the concrete and material.
- We build together towards a cyberspace that is interdependent.
- As such, we follow a method of loose collaboration which we call
- "stone soup".
- "stone soup". Rather than being formally led by a fixed group, we find and engage contributors for projects as they evolve from idea to completion, so that individuals with different talents can bring their contributions to the table.
`
const collaborationVerse = `
- On a broader scale, Verses works on
- objects,
- objects (creating artifacts, seeding frameworks and structure, mapping ecosystems),
- philosophies,
- philosophies (navigating contradiction, permitting sensemaking, building a prefigurative politics for pluriversality),
- community,
- community (maintaining and caring for the Verses community, extending care in tendrils to connected communities and space at large),
- capacity,
- capacity (enabling others to act on and materialize this prefiguration, predistributing and redistributing resources),
- and
- infrastructure.
- infrastructure (operational and structural tasks to cohere the above, and building scaffolding for objects, philosophies, and capacity-building to take place).
`
const makeMagicDiv = (artifactName) => (lineText) => {
const magic = document.createElement("span")
magic.innerText = lineText
magic.classList.add("magic")
const dropDiv = document.getElementById(`drop_${artifactName}`)
magic.addEventListener("mouseover", () => {
dropDiv.classList.add("drop-highlight")
const offset = dropDiv.offsetTop
document.getElementById("context-pane").scrollTo({
top: offset - 24, // add some extra viewing padding
behavior: "smooth"
})
})
magic.addEventListener("mouseout", () => {
dropDiv.classList.remove("drop-highlight")
})
return magic
}
const config = {
specialCharacters: {
"--": () => {
const sp = document.createElement("span")
sp.innerHTML = "—"
return sp
},
"\\*(.*)\\*": (lineText) => {
const el = document.createElement("strong")
el.appendChild(document.createTextNode(lineText))
return el
},
"(pluriverse|pluriversality)": makeMagicDiv("pluriverse"),
"(interdependent)": makeMagicDiv("declaration"),
}
}
const about = createTelescopicTextFromBulletedList(aboutVerse, config)
const collaboration = createTelescopicTextFromBulletedList(collaborationVerse, config)
const content = document.getElementById("about")
content.appendChild(about)
content.appendChild(collaboration)