Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: mikeocool/Space-Is-Huge
base: 4c4a0cd721
...
head fork: mikeocool/Space-Is-Huge
compare: 203b5f9a62
  • 4 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jan 22, 2012
@mikeocool adding space counter 83099c6
@mikeocool putting things to scale 6d6d684
@mikeocool Merge branch 'master' of github.com:mikeocool/Space-Is-Huge
* 'master' of github.com:mikeocool/Space-Is-Huge:
  front end placeholders
  base css & grid
a826688
@mikeocool hiding space counter 203b5f9
Showing with 42 additions and 10 deletions.
  1. +34 −2 space.js
  2. +8 −8 spacestuff.js
View
36 space.js
@@ -1,4 +1,3 @@
-
var SpaceIsHuge = function() {
var totalSpaceSize = 0;
@@ -27,11 +26,13 @@ var SpaceIsHuge = function() {
if(window.pageYOffset <= 0) {
if(totalSpaceSize < 1000) {
spaceTransition.height(Math.min(Math.max(spaceTransition.height() + delta, 0), 1000));
+ counterDiv.style.display = 'none';
} else {
spaceSize = Math.max(spaceDiv.height() + delta, 0);
spaceSpacer.height(spaceSize);
spaceDiv.height(spaceSize);
spaceTransition.css('top',spaceSize);
+ counterDiv.style.display = 'block';
}
totalSpaceSize = Math.max(0, totalSpaceSize + delta);
@@ -44,15 +45,33 @@ var SpaceIsHuge = function() {
return false
}
}
+
+ updateCounter();
}
}
+ function updateCounter() {
+ var uas = Math.round((totalSpaceSize / 100000.0) * 1000.0) / 1000.0;
+ var text = String(uas);
+ while(text.length < 5) {
+ text += '0';
+ }
+ text += ' AU';
+ counterDiv.innerHTML = text;
+ }
if (navigator.userAgent.toLowerCase().indexOf('webkit') >= 0) {
document.addEventListener('mousewheel', mouseWheel, false); // Chrome/Safari
} else {
document.body.addEventListener('DOMMouseScroll', mouseWheel, false); // Others
}
+
+ /*function scroll(e) {
+ var evt = window.event || e;
+ console.log(window.pageYOffset);
+ }*/
+ addEventListener(window, 'scroll', scroll);
+
addEventListener(window, 'resize', function(e){
spaceWidth = $('body').outerWidth(true);
spaceDiv.width(spaceWidth);
@@ -83,8 +102,21 @@ var SpaceIsHuge = function() {
'background-image': 'url(atmosphere_tall.png)',
'background-position': 'bottom center',
}).prependTo('body');
+
+ //draw space counter
+ var counterDiv = document.createElement('div');
+ spaceDiv.get(0).appendChild(counterDiv);
+ counterDiv.style.position = 'fixed';
+ counterDiv.style.right = '10px';
+ counterDiv.style.top = '10px';
+ counterDiv.style.borderWidth = '1px';
+ counterDiv.style.borderColor = '#fff';
+ counterDiv.style.padding = '5px';
+ counterDiv.style.color = '#fff';
+ counterDiv.style.display = 'none';
- var scale = 120;
+ //draw space things
+ var scale = 100000;
for(var i = 0; i < spaceThings.length; i++) {
var el = null;
if(spaceThings[i].img) {
View
16 spacestuff.js
@@ -1,21 +1,21 @@
var spaceThings = [
{
name:'Moon',
- distance:5,
+ distance:0.002,
width:220,
height:220,
img:'spacestuff/moon.png'
},
{
name:'Mars',
- distance:20,
+ distance:0.52,
width:640,
height:524,
img:'spacestuff/mars.png'
},
{
name:'Asteroid Belt',
- distance:40,
+ distance:1.7,
run:function(el) {
el.style.height = '900px';
el.style.width = "100%";
@@ -30,30 +30,30 @@ var spaceThings = [
},
{
name:'Jupiter',
- distance:80,
+ distance:4.2,
width:640,
height:524,
img:'spacestuff/jupiter.png'
},
{
name:'Saturn',
- distance:100,
+ distance:8.3,
width:640,
height:395,
img:'spacestuff/saturn.png'
},
{
name:'Uranus',
- distance:150,
+ distance:20.4,
width:970,
height:1000,
img:'spacestuff/uranus.png'
},
{
name:'Neptune',
- distance:180,
+ distance:30,
width:600,
height:588,
img:'spacestuff/neptune.png'
}
-];
+];

No commit comments for this range

Something went wrong with that request. Please try again.