// testing grounds
"use strict";
var mobileType = '',
isMobile = {
Windows: function() {
var checkW = /IEMobile|Windows Mobile/i.test(navigator.userAgent);
mobileType += checkW ? 'Windows Phones.' : '';
return checkW;
},
Android: function() {
var checkA = /Android/i.test(navigator.userAgent);
mobileType += checkA ? 'Android Phones.' : '';
return checkA;
},
BlackBerry: function() {
var checkB = /BlackBerry/i.test(navigator.userAgent);
mobileType += checkB ? 'BlackBerry.' : '';
return checkB;
},
iOS: function() {
var checkI = /iPhone|iPad|iPod/i.test(navigator.userAgent);
mobileType += checkI ? 'Apple iPhone, iPad or iPod.' : '';
return checkI;
},
any: function() {
return ( isMobile.Windows() || isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() );
}
},
checkMOBS = isMobile.any();
// protect phones, older / low end devices
if (document.body.offsetWidth < 1200 || checkMOBS) {
var explain = '';
explain += checkMOBS && mobileType !== '' ? ('For safety reasons, this page does not work with ' + mobileType) : '';
explain += !checkMOBS && document.body.offsetWidth < 1200 && mobileType === '' ? 'For safety reasons this page does not work on your machine because it might be very old. In other cases the browser window size is not enough for the animation to work properly, so if that\'s the case, maximize the window, refresh and proceed with the tests.' : '';
var warning = '
';
warning +='
Warning!
';
warning +='
This web page is only for high-end desktop computers.
';
warning +='
We do not take any responsibility and we are not liable for any damage caused through use of this website, be it indirect, special, incidental or consequential damages to your devices.
';
warning +='
'+explain+'
';
warning +='
';
document.body.innerHTML = warning;
throw new Error('This page is only for high-end desktop computers. ' + explain);
}
// generate a random number within a given range
function random(min, max) {
return Math.random() * (max - min) + min;
}
// the variables
var container = document.getElementById('container');
// vendor prefix handle for Tween.js
var transformProperty = KUTE.property('transform'), tws = [];
function complete(){
document.getElementById('info').style.display = 'block';
container.innerHTML = '';
tws = [];
}
function updateLeft(){
this.div.style['left'] = Math.floor(this.left) +'px';
}
function updateTranslate(){
this.div.style[transformProperty] = 'translate3d('+ Math.floor(this.x * 10) / 10 + 'px,0px,0px)';
}
function buildObjects(){
var c = document.querySelector('[data-count]'), e = document.querySelector('[data-engine]'), r = document.querySelector('[data-repeat]'),
p = document.querySelector('[data-property]'), ct = c && document.querySelector('[data-count]').getAttribute('data-count'),
count = ct ? parseInt(ct) : null,
engine = e && document.querySelector('[data-engine]').getAttribute('data-engine') || null,
repeat = r && document.querySelector('[data-repeat]').getAttribute('data-repeat') || null,
property = p && document.querySelector('[data-property]').getAttribute('data-property') || null,
warning = document.createElement('DIV');
warning.className = 'text-warning padding lead';
container.innerHTML = '';
if (count && engine && property && repeat) {
if (engine === 'gsap') {
document.getElementById('info').style.display = 'none';
}
createTest(count,property,engine,repeat);
// since our engines don't do sync, we make it our own here
if (engine==='tween'||engine==='kute') {
document.getElementById('info').style.display = 'none';
start();
}
} else {
if (!count && !property && !repeat && !engine){
warning.innerHTML = 'We are missing all the settings here.';
} else {
warning.innerHTML = 'Now missing
';
warning.innerHTML += !engine ? '- engine
' : '';
warning.innerHTML += !property ? '- property
' : '';
warning.innerHTML += !repeat ? '- repeat
' : '';
warning.innerHTML += !count ? '- count
' : '';
}
container.appendChild(warning);
}
}
function start() {
var now = window.performance.now(), count = tws.length;
for (var t =0; t';
b.setAttribute('data-'+link.parentNode.parentNode.parentNode.id, link.id);
}
}
}