Skip to content

Commit

Permalink
weird stuff inbound!
Browse files Browse the repository at this point in the history
  • Loading branch information
kaliumxyz committed May 4, 2017
1 parent 5363b19 commit 43e1802
Show file tree
Hide file tree
Showing 10 changed files with 2,433 additions and 493 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
60 changes: 31 additions & 29 deletions index.html → app/index.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<title>ASAP</title>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
<link href='style.css' rel='stylesheet'>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=0"/>
</head>
<body>
<h1>press space or tap the screen</h1>
<div class='center'>
<ul class='options terminal'>
<li>
<span class='cursor'>b</span>ounds? <span class="option active">y</span>/<span class='option'>n</span>
</li>
<li>
gravity? <span class='option active'>[wiggly]</span>/<span class='option'>[wigglyInverse]</span>/<span class='option'>[regular]</span>
</li>
<li>
collisions? <span class='option'>[boring]</span>/<span class='option active'>[care]</span>
</li>

</ul>
</div>

<canvas width="1000" height="1000">If you can read this, your browser does not support HTML5 canvas.</canvas>
</body>
<script src='load.js'></script>
</html>
<!DOCTYPE html>
<html>
<head>
<title>ASAP</title>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
<link href='style.css' rel='stylesheet'>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=0"/>
</head>
<body>
<main>
</main>
<h1>press space or tap the screen</h1>
<div class='center'>
<ul class='options terminal'>
<li>
<span class='cursor'>b</span>ounds? <span class="option active">y</span>/<span class='option'>n</span>
</li>
<li>
gravity? <span class='option active'>[wiggly]</span>/<span class='option'>[wigglyInverse]</span>/<span class='option'>[regular]</span>
</li>
<li>
collisions? <span class='option'>[boring]</span>/<span class='option active'>[care]</span>
</li>

</ul>
</div>

<canvas width="1000" height="1000">If you can read this, your browser does not support HTML5 canvas.</canvas>
</body>
<script src='load.js'></script>
</html>
108 changes: 54 additions & 54 deletions load.js → app/load.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
"use strict"

const select = selector => document.querySelector(selector)

const selectAll = selector => document.querySelectorAll(selector)

const loadScript = _ => {
let script = document.createElement("script")
script.setAttribute("src","main.js")
select("head").appendChild(script)
select('h1').innerText = "A Simple Aesthetic Particle engine"
select('.options').setAttribute('style','display:none;')
}

const canvas = select('canvas')


window.onresize = _ => {
canvas.width = window.innerWidth
canvas.height = window.innerHeight
}

window.onload = window.onresize

// look I'll fix this later lol.
const moveCursor = {
left: ev => {
const terminal = select('.terminal')
const match = terminal
.innerHTML
.replace(/(.)<span class="cursor">(.*?)<\/span>/,'<span class="cursor">$1</span>$2')
terminal.innerHTML = match
},
right: ev => {
const terminal = select('.terminal')
const match = terminal
.innerHTML
.replace(/<span class="cursor">(.*?)<\/span>(.)/,'$1<span class="cursor">$2</span>')
terminal.innerHTML = match
},
}


const keys = []
keys[32] = loadScript
keys[37] = moveCursor.left
// keys[38] = moveCursor
keys[39] = moveCursor.right
// keys[40] = moveCursor

// call the function corresponding to the key.
window.onkeydown = e => keys[e.keyCode]()
window.onclick = loadScript

"use strict"

const select = selector => document.querySelector(selector)

const selectAll = selector => document.querySelectorAll(selector)

const loadScript = _ => {
let script = document.createElement("script")
script.setAttribute("src","main.js")
select("head").appendChild(script)
select('h1').innerText = "A Simple Aesthetic Particle engine"
select('.options').setAttribute('style','display:none;')
}

const canvas = select('canvas')


window.onresize = _ => {
canvas.width = window.innerWidth
canvas.height = window.innerHeight
}

window.onload = window.onresize

// look I'll fix this later lol.
const moveCursor = {
left: ev => {
const terminal = select('.terminal')
const match = terminal
.innerHTML
.replace(/(.)<span class="cursor">(.*?)<\/span>/,'<span class="cursor">$1</span>$2')
terminal.innerHTML = match
},
right: ev => {
const terminal = select('.terminal')
const match = terminal
.innerHTML
.replace(/<span class="cursor">(.*?)<\/span>(.)/,'$1<span class="cursor">$2</span>')
terminal.innerHTML = match
},
}


const keys = []
keys[32] = loadScript
keys[37] = moveCursor.left
// keys[38] = moveCursor
keys[39] = moveCursor.right
// keys[40] = moveCursor

// call the function corresponding to the key.
window.onkeydown = e => keys[e.keyCode]()
window.onclick = loadScript

//document.querySelectorAll('.option').forEach(el => el.onclick = ev => el.setAttribute('class','active'))
Loading

0 comments on commit 43e1802

Please sign in to comment.