Skip to content

Instantly share code, notes, and snippets.

@vlmonk
Created May 27, 2012 09:51
Show Gist options
  • Save vlmonk/2803117 to your computer and use it in GitHub Desktop.
Save vlmonk/2803117 to your computer and use it in GitHub Desktop.
var amazon = 'https://s3-eu-west-1.amazonaws.com/td.aws/';
var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())),
isIphone = (/iphone/i.test(navigator.userAgent.toLowerCase())),
isIpad = (/ipad/i.test(navigator.userAgent.toLowerCase())),
isTouch = 'ontouchstart' in window,
mobRatio = 2;
var AUTHED = false,
cmahsxcto = 0,
METERS = 0,
TIME = 0,
PIXELS_PER_METERS = isIphone ? 2000 : 4000,
cmahsxcto_nyrotmxzx = isIphone ? 190 : 400,
cmahsxcto_smkeoipdq = texture[texture.length - 2][7] / (isIphone ? 2 : 1),
LAYER = 1,
MILESTONE = '',
MILESTONE_cmahsxcto = 0,
FINISH_MSG_SHOW = false,
IMAGES_LIST = false,
IMAGES_LIST_LENGTH = 0,
IMG_POSITION, pause = false,
windowMarginTop = 0,
finalCentering, _width = 0,
_height = 0,
movePerFrame = 50,
highresTimeout, STARTOVER = false,
MOVING = false,
MOVINGTIMER;
var finalScene = false,
finalSceneFrame, waitingFB = false,
reInited = false;
var firstImages = 0;
var msgLoadingEndTimer;
function showMessage(id) {
id.css({
top: -id.height(),
opacity: 0,
display: 'block',
marginTop: -(id.outerHeight()) * 0.5
}).animate({
top: '50%',
opacity: 1
}, 500);
$('#fade').stop(true, true).animate({
opacity: 0.5
})
};
function msgLoadingEnd() {
clearTimeout(msgLoadingEndTimer);
msgLoadingEndTimer = setTimeout(function () {
waitingFB = true;
$('#msgLoading').fadeOut(function () {
if ((firstImages == 2 || reInited)) {
showMessage($('#msgHelp'));
$('#fade').stop(true, true).fadeOut()
}
if ($('.message').length === 0) {
if (!FINISH_MSG_SHOW) $('#fade').stop(true, true).fadeOut()
}
})
}, 5000)
};
$.fn.preload = function () {
this.each(function () {
$('<img/>')[0].src = this
})
};
function RE_INIT(meters) {
function RE_INIT_continue() {
$('.iphoneLogin').slideUp();
$('#ground').empty().append('<div id="final"><img src=""></div>');
for (var i = 0; i < texture.length; i++) texture[i][1] = [];
METERS = meters;
if (window.location.hash.indexOf('gogogo') != -1) {
METERS = 7980
}
cmahsxcto = Math.round(METERS * PIXELS_PER_METERS);
$('#ground').css({
top: -cmahsxcto
});
if (waitingFB && !FINISH_MSG_SHOW) $('#fade').stop(true, true).fadeOut();
$('#stat, #sideBar').fadeIn();
$('#msgHelp').remove();
FINISH_MSG_SHOW = false;
IMAGES_LIST = false;
msgLoadingEnd();
checkDepthRange(0);
$(window).resize()
}
reInited = true;
if (meters == 0) {
finalScene = false;
TIME = 0;
RE_INIT_continue()
}
else {
RE_INIT_continue()
}
};
function checkOrientation() {
if (mobile) {
if ($(window).height() > $(window).width()) {
$('body').removeClass('landscape').addClass('portrait')
}
else {
$('body').removeClass('portrait').addClass('landscape')
}
}
};
var prevDepth = 10;
function checkDepthRange(inc) {
if (cmahsxcto + inc <= 0) {
cmahsxcto = 0
}
else {
if (cmahsxcto + inc >= cmahsxcto_smkeoipdq - windowMarginTop + finalCentering) {
if (cmahsxcto >= cmahsxcto_smkeoipdq - windowMarginTop + finalCentering + (353 - 240 - 1) * movePerFrame) {
cmahsxcto = cmahsxcto_smkeoipdq - windowMarginTop + finalCentering + (353 - 240 - 1) * movePerFrame
}
cmahsxcto += inc;
if (!finalScene) {
finalScene = true;
$('#final').show()
}
finalSceneFrame = parseInt((cmahsxcto - (cmahsxcto_smkeoipdq - windowMarginTop + finalCentering)) / movePerFrame) + 240;
$('#final img')[0].src = amazon + 'texturesEndThumb/borjOmm_forSite_00' + finalSceneFrame + '.jpg';
if (prevDepth != cmahsxcto) {
$('#final .highres').hide();
clearTimeout(highresTimeout);
highresTimeout = setTimeout(function () {
$('#final .highres').remove();
$('<img src="' + amazon + 'texturesEnd/borjOmm_forSite_00' + finalSceneFrame + '.jpg" class="highres">').appendTo('#final')
}, 500)
}
else {}
prevDepth = cmahsxcto
}
else {
cmahsxcto += inc;
if (finalScene) {
finalScene = false;
$('#final').hide()
}
}
}
if (prevDepth != cmahsxcto) {
MOVING = true;
clearTimeout(MOVINGTIMER);
MOVINGTIMER = setTimeout(function () {
MOVING = false
}, 2000)
}
prevDepth = cmahsxcto
};
var checkMilestoneDiv = 3,
checkMilestonPrev = -1,
checkMilestonTime, mileDepth = -1,
mileMsg = -1,
mileImg = -1,
mileLink = -1,
mileSameCount = 0,
mileOut = true;
function checkMilestone(resp) {
mileDepth = resp.nearest_depth;
mileMsg = resp.nearest_message;
mileImg = resp.nearest_image;
mileLink = resp.nearest_link;
mileSameCount = resp.same_count
}
function mileGoAway() {
checkMilestonTime = setTimeout(function () {
MILESTONE = '';
MILESTONE_cmahsxcto = 0;
$('.mileStone').stop().fadeOut(function () {
$(this).remove()
});
checkMilestonPrev = -1
}, 3000)
}
function initMileStone() {
setInterval(function () {
if (METERS > mileDepth && mileDepth > METERS - checkMilestoneDiv) {
clearTimeout(checkMilestonTime);
if (mileDepth != checkMilestonPrev && mileOut) {
mileOut = false;
checkMilestonPrev = mileDepth;
$('<div class="mileStone"><div class="image"><img src="' + mileImg + '"></div><div class="info"><div class="title">You’ve reached ' + mileDepth + ' m.</div><div class="txt">' + mileMsg + '</div>' + ($('body').hasClass('auth') ? '<div class="checkInText">To check in on this depth use “CHECK IN HERE” Button</div>' : '') + '</div></div>').appendTo('#outer').hide().fadeIn();
MILESTONE = mileMsg;
MILESTONE_cmahsxcto = mileDepth;
$('.mileStone:not(:last)').stop().fadeOut(function () {
$(this).remove()
})
}
else {
mileGoAway()
}
}
else {
mileOut = true
}
}, 500);
$('.mileStone .close').live('click', function () {
$(this).parents('.mileStone').stop().fadeOut(function () {
$(this).remove();
checkMilestonPrev = -1
})
})
}
$(function () {
initMileStone()
});
$(function () {
$('<div id="ground"><div id="final"><img src=""></div></div><div id="fbAuth"><a href="#" id="fb-login">Use facebook to save your progress</a><a href="#" id="fb-logout" style="display: none;">Sign out</a><span id="refresh">Start over</span><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fthedeepestsite.com%2F&amp;send=false&amp;layout=button_count&amp;width=20&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=25&amp;appId=355078491181676&amp;locale=en_US" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width: 90px; height:25px; margin-right: 24px; top: 2px; left: 5px; vertical-align: bottom;" allowTransparency="true"></iframe><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://thedeepestsite.com" data-text="I\'m underground on" data-hashtags="borjomi,thedeepestsite">Tweet</a></div><div class="goVideo">WATCH VIDEO</div><a id="madeBy" href="http://fix-digital.com/" target="_blank">made by <span>FIX</span></a><div id="copyright"><a href="/privacy/" target="_blank">Privacy</a> © 2012 Borjomi</div><div id="stat"><i></i><u></u></div><div id="sideBar"><span class="wrap"><div class="depth">Depth (metre): <b>0</b></div><div class="avarageSpeed">Current speed: <b><span>0</span> cm/s</b></div><div class="timeSpent">Time spent:<b>0 h 0 min 0 sec</b></div><div class="peopleSame" id="peopleSame">People on the same <br />depth and below: <b>0</b></div></span><div class="btnLegend"><span>Hide legend</span> <i class="close"></i><i class="dropDown"></i></div></div><div class="checkInHere">check in here</div><div class="iphoneLogin"><div class="title">Use facebook to save your progress</div><div class="goLogin"></div></div><div id="fade"></div><div id="msgHelp" class="message"><h3>Welcome to Borjomi, Georgia, home of the deepest site in the world.</h3><p>Here you can discover the source of our mineral water, a volcanic spring 8000m under the surface of the earth.</p><div class="scrollTo">Start scrolling <div class="or">OR</div><div class="video">Watch video about the site</div></div><div class="btn btnEnter">Enter</div></div><div class="refreshMsg"><div class="title">Start your journey over?</div><span class="yes">Yes</span><span class="no">No</span></div><div class="finishMsg"><div class="title">Congratulations, you’ve reached<br>the source of Borjomi!</div><div class="text1">Depth: 8,000m. Time spent:&nbsp; <span class="time"></span>.<br>Average speed: <span class="avSpeed"></span>m/s.</div><div class="text2">Check in here and carve your name in the rock.</div><div class="button"></div></div><div id="video"><div class="title">What it’s all about</div><div class="video"></div><div class="close">Close</div></div>').appendTo('#outer');
!
function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = "//platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs)
}
}(document, "script", "twitter-wjs");
$('.message .scrollTo .video, .goVideo').click(function () {
$('.message .btnEnter').click();
if ($('#video').is(':visible')) return false;
$('#video').fadeIn();
$('#video .video').append('<iframe width="554" height="337" src="http://www.youtube.com/embed/SCodfWNcUk8?hl=en_US&autoplay=1&loop=0&hd=0&fs=1&rel=0" frameborder="0" allowfullscreen></iframe>')
});
$('#video .close').click(function () {
$('#video iframe').remove();
$('#video').fadeOut()
});
var ground = $('#ground'),
fieldDepth = $('.depth b'),
fieldAvarageSpeed = $('.avarageSpeed span'),
fieldTimeSpent = $('.timeSpent b'),
fieldPeopleSame = $('.peopleSame b'),
statCursor = $('#stat u'),
speedStep = 3,
speedStepDown = 0.5,
maxSpeed = 60,
frameTime = 25;
var groundWidth = 1920,
scrolled = false,
speed = 0,
direction = 1,
textureCount = 0,
touchStartY = -1,
touchEndY = -1,
touchStartTime, touchEndTime, y1 = 0,
y2 = 0,
textureSize = texture.length,
textureAdd = '';
var startImageWidth = _width,
startImageDiv = 0,
showRightPart = false,
firstScroll = false,
timeToFinish = false;
for (var i = 0; i < legend.length; i++) {
legend[i][1] *= PIXELS_PER_METERS
}
if (mobile) {
textureAdd = 1024;
groundWidth = 1024;
$('body').addClass('mobile')
}
else {
$('body').addClass('desktop')
}
if (isIpad) $('body').addClass('ipad');
if (isIphone) $('body').addClass('iphone');
if (isIphone) {
groundWidth /= mobRatio;
for (var i = 0; i < textureSize; i++) {
for (var j = 2; j <= 7; j++) {
texture[i][j] /= 2
}
}
}
function secondsToTime() {
var secs = TIME += 0.25;
var hours = Math.floor(secs / (60 * 60));
var divisor_for_minutes = secs % (60 * 60);
var minutes = Math.floor(divisor_for_minutes / 60);
var divisor_for_seconds = divisor_for_minutes % 60;
var seconds = Math.ceil(divisor_for_seconds);
var obj = {
"h": hours,
"m": minutes,
"s": seconds
};
return obj.h + ' h ' + obj.m + ' min ' + obj.s + ' sec'
}
$('#fb-login').click(function () {
if (isIphone) {
$('.iphoneLogin').slideDown();
return false
}
});
$('.iphoneLogin .close').click(function () {
$(this).parent().slideUp()
});
$('#sideBar .btnLegend').click(function () {
if ($(this).hasClass('closed')) {
$(this).removeClass('closed');
$('span', this).text('Hide legend');
if (!isIphone) {
$('#stat').stop(true, true).slideDown(150)
}
else {
$('#sideBar .wrap').stop(true, true).slideUp();
$('#stat').stop(true, true).animate({
top: '3.5em',
opacity: 1
})
}
}
else {
$(this).addClass('closed');
$('span', this).text('Show legend');
if (!isIphone) {
$('#stat').stop(true, true).slideUp(150)
}
else {
$('#sideBar .wrap').stop(true, true).slideDown();
$('#stat').stop(true, true).animate({
top: '18em',
opacity: 0
})
}
}
});
if (isIphone) $('#sideBar .btnLegend').click();
function checkGradients() {
if ($(window).width() > ground.width()) {
if ($('.leftGrad').length == 0) $('<i class="leftGrad" /><i class="rightGrad" />').appendTo('#outer')
}
else {
if ($('.leftGrad').length > 0) $('.leftGrad, .rightGrad').remove()
}
}
var xxxx_ = 1200 * (mobile ? (1024 / 1920) : 1),
xxxx__ = 600 * (mobile ? (1024 / 1920) : 1);
function initStartImage() {
startImageWidth = _width < xxxx_ ? _width < xxxx__ ? ((xxxx__) / xxxx_ * 100) + '%' : ((_width) / xxxx_ * 100) + '%' : '100%';
if (mobile) startImageWidth = '100%';
$('.startImage .img1').css({
width: startImageWidth,
bottom: (100 - parseInt(startImageWidth)) * 1.25
});
if ($('.startImage .img1').length > 0) {
startImageDiv = _height - ($('.startImage .img1').height() > 0 ? $('.startImage .img1').height() : 1000);
if (startImageDiv <= 0) startImageDiv = 0
}
windowMarginTop = startImageDiv + (texture[0][3] - _height > cmahsxcto_nyrotmxzx ? cmahsxcto_nyrotmxzx : texture[0][3] > _height ? texture[0][3] - _height : 0);
ground.css({
marginTop: -windowMarginTop
})
}
function addLegend() {
var elements = '';
for (var i = 1; i < legend.length; i++) elements += '<div class="legend' + i + '" style="height:' + ((legend[i][1] - legend[i - 1][1]) / legend[legend.length - 1][1] * 100) + '%"><span class="l_"><span class="l__">' + legend[i][0] + '</span></span></div>';
$('#stat').append(elements + '<div class="legend8"><span class="l_"><span class="l__">The Borjomi Source</span></span></div>')
}
$(window).keydown(function (e) {
var code = e.keyCode ? e.keyCode : e.which;
switch (code) {
case 13:
$('.message .btnEnter').click()
}
});
$('.message .close, .message .btnEnter').live('click', function () {
$(this).parents('.message').fadeOut(500, function () {
$(this).remove();
$('#fade').stop(true, true).fadeOut(500)
})
});
$('#refresh').click(function () {
$('.refreshMsg').fadeIn()
});
$('.refreshMsg .no').click(function () {
$(this).parent().fadeOut()
});
$('.checkInHere').click(function () {
for (var i = 0; i < legend.length - 1; i++) {
if (legend[i][1] <= cmahsxcto && cmahsxcto < legend[i + 1][1]) {
send_to_fb($('#fbAuth span').first().text(), null, METERS.toFixed(2), i);
break
}
}
});
$('.finishMsg .button').click(function () {
var box = $(this).parent()
});
function onLoad(id, func) {
id.each(function () {
if ($(this)[0].complete) {
func();
return
}
$(this).load(function () {
func()
})
})
}
function initTexture() {
if (finalScene) return false;
for (var i = 0; i < textureSize; i++) {
var textureName = texture[i][0],
textureIndex = texture[i][1],
textureWidth = texture[i][2],
textureHeight = texture[i][3],
textureIntervalY = texture[i][4],
textureDivY = texture[i][5],
textureStart = texture[i][6],
textureEnd = texture[i][7],
textureRepeat = texture[i][8],
yStart = cmahsxcto,
yEnd = yStart + _height,
addDist = 3,
removeDist = 5,
from = Math.floor((yStart) / textureIntervalY) - 1 - addDist,
to = Math.ceil(yEnd / textureIntervalY) + addDist,
displace = textureStart % textureIntervalY;
if (direction > 0) {
for (var j = from - removeDist; j <= from; j++) {
$('#' + textureName + (j)).remove();
textureIndex[j] = undefined
}
}
else {
for (var j = to; j < to + removeDist; j++) {
$('#' + textureName + (j)).remove();
textureIndex[j] = undefined
}
}
var elements = '';
for (var j = from; j < to; j++) {
if (typeof textureIndex[j] === 'undefined') {
var y = j * textureIntervalY + displace;
if (y >= textureStart && y < textureEnd) {
var x = textureDivY === 0 ? 0 : groundWidth * (Math.random() * 2 - 0.5) - textureWidth * 0.5,
width = (textureAdd == '' ? textureWidth : isIphone ? 512 : textureAdd) + 'px';
y += textureDivY * (Math.random() * 2 - 1);
textureIndex[j] = [x, y];
if (!(textureDivY != 0 && mobile)) {
if (textureName == 'g00') {
$('<div id="' + textureName + j + '" class="startImage" style="left: ' + x + 'px; top: ' + y + 'px; width: ' + width + '; height: ' + textureHeight + 'px; z-index: ' + (textureDivY === 0 ? 0 : Math.ceil(Math.random() * textureSize)) + ';"><table><tr><td><img class="img1" src="' + amazon + 'textures' + textureAdd + '/' + (textureName.split('g')[1]) + '.jpg" style="width: ' + startImageWidth + 'px;' + (textureDivY == 0 ? (' background: url(' + amazon + 'thumb/' + (textureName.split('g')[1]) + textureAdd + '.jpg"') : '') + '"><img class="img2" src="' + amazon + 'textures' + textureAdd + '/' + (textureName.split('g')[1]) + '.png"></td></tr></table></div>').appendTo(ground);
initStartImage();
if (STARTOVER) {
$('#fade, #msgLoading').show().css({
opacity: 1
})
};
onLoad($('#' + textureName + j + ' .img1, #' + textureName + j + ' .img2'), function () {
if (STARTOVER) {
setTimeout(function () {
$('#fade, #msgLoading').fadeOut()
}, 1000);
STARTOVER = false
};
firstImages++;
if (firstImages == 2) {
initStartImage();
if (waitingFB) showMessage($('#msgHelp'))
}
})
}
else {
elements += '<img id="' + textureName + j + '" src="' + amazon + 'textures' + textureAdd + '/' + (textureName.split('g')[1]) + '.' + (textureDivY == 0 ? 'jpg' : 'png') + '" style="left: ' + x + 'px; top: ' + y + 'px; width: ' + width + '; height: ' + textureHeight + 'px; z-index: ' + (textureDivY === 0 ? 0 : Math.ceil(Math.random() * textureSize)) + ';' + (textureDivY == 0 ? (' background: url(' + amazon + 'thumb/' + (textureName.split('g')[1]) + '.jpg"') : '') + ' />'
}
}
}
}
}
$(elements).appendTo(ground)
}
}
function checkDepth() {
if (scrolled) {
scrolled = false;
direction > 0 ? speed < maxSpeed ? speed += speedStep : speed = maxSpeed : speed > -maxSpeed ? speed += -speedStep : speed = -maxSpeed
}
else {
direction > 0 ? speed > 0 ? speed -= speedStepDown : speed = 0 : speed < 0 ? speed += speedStepDown : speed = 0
}
checkDepthRange(speed);
if (cmahsxcto <= 0 || cmahsxcto >= cmahsxcto_smkeoipdq - windowMarginTop + finalCentering + (353 - 240 - 1) * movePerFrame) speed = 0
}
var pointY;
var y1, y2, t1, t2, minDistance = 40,
friction = 0.75;
var speedPrevPoint = cmahsxcto,
checkTimeSpeed = 0;
$(window).each(function () {
this.ontouchstart = function (e) {
var point = e.touches[0];
if (e.touches.length == 1) pointY = point.pageY;
y1 = point.pageY;
t1 = e.timeStamp;
ground.stop();
ground.css("text-indent", 100);
checkTimeSpeed = new Date()
};
this.ontouchmove = function (e) {
e.preventDefault();
if (pause) return false;
var point = e.touches[0],
deltaY = point.pageY - pointY;
var now = e.timeStamp;
pointY = point.pageY;
checkDepthRange(-deltaY);
ground.css({
top: -cmahsxcto
});
checkTimeSpeed = now
};
this.ontouchend = function (e) {
if (pause) return false;
var point = e.changedTouches[0];
y2 = point.pageY;
t2 = e.timeStamp;
var dY = y2 - y1,
dMs = Math.max(t2 - t1, 1),
speedY = Math.max(Math.min(dY / dMs, 2), -2),
distance = Math.sqrt(Math.pow(y1 - y2, 2));
if (distance > minDistance) {
var lastStepTime = new Date();
ground.stop().animate({
textIndent: '0'
}, {
easing: 'linear',
duration: Math.abs(speedY) * 1000 * 15,
step: function (currentStep) {
speedY *= (currentStep / 100) * 1.00;
var now = new Date();
var stepDuration = now.getTime() - lastStepTime.getTime();
lastStepTime = now;
var pixelStep = parseInt(speedY * stepDuration / friction);
checkDepthRange(-pixelStep);
ground.css({
top: -cmahsxcto
})
}
})
}
}
});
addLegend();
msgLoadingEnd();
if (!mobile) {
if (finalScene) return false;
function renderFrame() {
checkDepth();
ground.css({
top: -cmahsxcto
});
setTimeout(renderFrame, frameTime)
}
renderFrame()
}
setInterval(function () {
METERS = cmahsxcto / PIXELS_PER_METERS
}, frameTime);
setInterval(initTexture, 250);
var is_loadFinalScene = false,
loadFinalScene_counter = 240;
function loadFinalScene() {
if (loadFinalScene_counter < 353 + 1) {
if (is_loadFinalScene == true) {
onLoad($('<img/>').attr('src', amazon + 'texturesEndThumb/borjOmm_forSite_00' + loadFinalScene_counter + '.jpg'), function () {
if (loadFinalScene_counter == 240) {
$('<img/>').attr('src', amazon + 'textures/xx.jpg')
}
loadFinalScene_counter++;
console.log(loadFinalScene_counter);
loadFinalScene()
})
}
}
}
setInterval(function () {
if (!showRightPart && METERS > 0.3) {
showRightPart = true;
$('#stat, #sideBar').fadeIn()
}
if (!firstScroll && cmahsxcto != 0) {
firstScroll = true;
$('#msgHelp .btnEnter').click()
}
if (METERS > 7980) {
if (!is_loadFinalScene) {
is_loadFinalScene = true;
loadFinalScene()
}
}
else {
is_loadFinalScene = false
}
if ((cmahsxcto_smkeoipdq - windowMarginTop + finalCentering + (353 - 240 - 1) * movePerFrame - 1000 < cmahsxcto) && !FINISH_MSG_SHOW && !pause) {
pause = true;
$('.finishMsg, #fade').stop(true, true).fadeIn();
$('#fade').animate({
opacity: 0.5
});
$('.finishMsg .time').html($('#sideBar .timeSpent b').html());
$('.finishMsg .avSpeed').html((8000 / TIME).toFixed(2));
$('#stat, #sideBar').fadeOut()
}
if (cmahsxcto_smkeoipdq - 10000 < cmahsxcto && !IMAGES_LIST) {
IMAGES_LIST = true;
load_image_messages()
}
}, 500);
setInterval(function () {
fieldDepth.text(METERS >= 8000 ? 8000 : METERS >= 1000 ? METERS.toFixed(0) : METERS >= 100 ? METERS.toFixed(1) : METERS.toFixed(2));
if (mobile) {
speed = Math.abs(cmahsxcto - speedPrevPoint) / PIXELS_PER_METERS * 100 * 2;
speedPrevPoint = cmahsxcto
}
fieldAvarageSpeed.text(Math.abs((speed)) > maxSpeed ? maxSpeed : Math.abs((speed).toFixed(0)));
if (!pause) fieldTimeSpent.text(secondsToTime());
fieldPeopleSame.text(mileSameCount);
statCursor.css({
top: ((cmahsxcto > cmahsxcto_smkeoipdq ? cmahsxcto_smkeoipdq : cmahsxcto) / cmahsxcto_smkeoipdq * 100) + '%'
})
}, 250);
$(window).bind('resize', function () {
var bgImgWidth = isIphone ? 960 : 1920,
bgImgHeight = isIphone ? 540 : 1080;
_width = $('body').width();
_height = $('body').height();
finalCentering = ((texture[texture.length - 1][3]) - _height) - (bgImgHeight - _height) / 2;
initTexture();
checkOrientation();
ground.css({
left: '50%',
width: groundWidth,
marginLeft: -(groundWidth) / 2
});
if (!mobile) checkGradients();
initStartImage();
$('#final').css({
width: bgImgWidth,
height: bgImgHeight,
marginLeft: -bgImgWidth / 2,
marginTop: -bgImgHeight / 2
})
}).resize();
$('body').mousewheel(function (objEvent, intDelta) {
if (pause) return false;
scrolled = true;
intDelta < 0 ? direction = 1 : direction = -1;
return false
});
if (window.location.hash.indexOf('gogogo') != -1) {
RE_INIT(0)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment