Skip to content

Commit

Permalink
Remove README.
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-schroeder-dev committed Oct 4, 2020
1 parent 5602986 commit ce16e58
Show file tree
Hide file tree
Showing 6 changed files with 231 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

20 changes: 20 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<html>
<head>
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script type="text/javascript" src="jump.js"></script>
</head>
<body>
<a-scene>

<a-camera jump="height: 4; interval: 1000;" wasd-controls="acceleration: 1000">
<a-cursor></a-cursor>
</a-camera>

<a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9"></a-box>
<a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
<a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
<a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
<a-sky color="#ECECEC"></a-sky>
</a-scene>
</body>
</html>
32 changes: 32 additions & 0 deletions jump.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const JUMP_KEY = ' ';

AFRAME.registerComponent('jump-refined', {
schema: {
height: {
type: 'number',
},
interval: {
type: 'number'
},
timingFunction: {
type: 'string'
},
},
init: function() {
document.addEventListener('keydown', e => {
if (e.key != JUMP_KEY) return;

const upInterval = setInterval(() => this.el.object3D.position.y += this.data.height / this.data.interval, 10);

setTimeout(() => {

clearInterval(upInterval);

const downInterval = setInterval(() => this.el.object3D.position.y -= this.data.height / this.data.interval, 10);

setTimeout(() => clearInterval(downInterval), this.data.interval / 2);

}, this.data.interval / 2);
});
},
});
163 changes: 163 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "jump",
"version": "1.0.0",
"description": "",
"main": "jump.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"http-server": "^0.12.3"
}
}

0 comments on commit ce16e58

Please sign in to comment.