You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
5.4 KiB
HTML

<!DOCTYPE html>
<html>
<style>
body {
font-family: "Courier New", monospace;
font-size: x-large;
}
.wrapper {
width: 100vw;
height: 100vh;
display: grid;
grid-template-columns: 1fr;
}
.wrapper div {
width: 100%;
justify-self: center;
}
@media (min-width: 1200px) {
.wrapper {
grid-template-columns: 1fr 1fr;
}
.wrapper div:first-child {
justify-self: start;
}
.wrapper div:last-child {
justify-self: end;
margin-top: 10%;
}
}
#flyer {
width: 100%;
max-width: 800px;
}
#animated-header {
text-align: center;
font-size: xx-large;
}
#filestructure ul {
display: table;
margin: 0 auto;
}
#filestructure ul li {
padding: 5%;
}
</style>
12 months ago
<body>
<div class="wrapper">
<!-- the flyer svg -->
<object id="flyer" type="image/svg+xml" data="flyer.svg" ></object>
<div>
<div id="filestructure">
<!-- <h1 id="animated-header">BROWSE THE FILESTRUCTURE >>></h1> -->
<div id="animated-header"></div>
<ul>
<li>/Door: <a href="https://hub.xpub.nl/chopchop/~v/hdwgh/index.html">How did we get here?</a></li>
<li>/Table: <a href="https://hub.xpub.nl/chopchop/si-23-website-table/">loading: feminist server...</a></li>
<li>/Kitchen: <a href="https://hub.xpub.nl/chopchop/~chef/kitchen/intropage.html">The Greasy Chip</a></li>
9 months ago
<li>/Shelves: <a href="https://hub.xpub.nl/chopchop/tl-dr/quilt.html">TL;DR</a></li>
<li>/Aquarium: <a href="https://hub.xpub.nl/chopchop/~zz1/Entrance/entrance.html">Aquarium</a></li>
</ul>
</div>
</div>
</div>
12 months ago
</body>
<script>
// function to get a random polarity, returns 1 or -1
function get_r_polarity() {
var r = Math.floor(Math.random() * 2);;
if (r==0) return 1;
return -1;
}
// get the svg element in the DOM
var flyer_obj = document.getElementById("flyer");
// start animation once the svg element is loaded
flyer_obj.addEventListener("load",function(){
// fetch the svg structure and find all elements belonging to the class 'moveable'
var svg_doc = flyer_obj.contentDocument;
var moveables = svg_doc.getElementsByClassName("moveable");
// function to move one random element of the class 'moveable'
function move_svg_el() {
// generate a random id
var r_id = Math.floor(Math.random() * moveables.length);
// generate random translations (unbounded, minimum of 10px)
var r_x = get_r_polarity() * (Math.random(50) + 10);
var r_y = get_r_polarity() * (Math.random(50) + 10);
// translate the selected element with the generated distances
var s = 'translate(' + r_x.toString() + ',' + r_y.toString() + ')';
moveables[r_id].setAttribute('transform',s);
}
// eveny 100ms, call the function that animates one element
var timer = setInterval(move_svg_el, 200);
}, false);
// inspired by: https://codepen.io/alan8r/
function ASCIIAnimation(animArray, DOMtarget, speed, looping = true) {
var currentFrame = 0;
for(var i = 0; i < animArray.length; i++) {
animArray[i] = animArray[i].replace(/ /g,"&nbsp;");
animArray[i] = "<pre>" + animArray[i] + "</pre>";
}
DOMtarget.innerHTML = animArray[0];
currentFrame++;
this.animation = setInterval(function() {
DOMtarget.innerHTML = animArray[currentFrame];
currentFrame++;
if(currentFrame >= animArray.length && looping) currentFrame = 0;
if (currentFrame >= animArray.length && !looping) currentFrame = animArray.length - 1;
}, speed);
this.getCurrentFrame = function() {
return currentFrame;
}
}
ASCIIAnimation.prototype.stopAnimation = function() {
clearInterval(this.animation);
}
var header_anim_array = [
"BROWSE THE FILESTRUCTURE [ ]",
"BROWSE THE FILESTRUCTURE [> ]",
"BROWSE THE FILESTRUCTURE [>> ]",
"BROWSE THE FILESTRUCTURE [>>> ]",
"BROWSE THE FILESTRUCTURE [ >>> ]",
"BROWSE THE FILESTRUCTURE [ >>> ]",
"BROWSE THE FILESTRUCTURE [ >>> ]",
"BROWSE THE FILESTRUCTURE [ >>> ]",
"BROWSE THE FILESTRUCTURE [ >>> ]",
"BROWSE THE FILESTRUCTURE [ >>> ]",
"BROWSE THE FILESTRUCTURE [ >>> ]",
"BROWSE THE FILESTRUCTURE [ >>> ]",
"BROWSE THE FILESTRUCTURE [ >>>]",
"BROWSE THE FILESTRUCTURE [ >>]",
"BROWSE THE FILESTRUCTURE [ >]",
];
var header_div = document.getElementById("animated-header");
var loading_anim = new ASCIIAnimation(header_anim_array, header_div, 300);
</script>
<script src="https://issue.xpub.nl/23/quilt/quilt.js" data-cutFileName="false" data-cutFileName="false"></script>
<link rel="stylesheet" type="text/css" href="https://issue.xpub.nl/23/quilt/quilt.css">
12 months ago
</html>