updated project to build with gulpjs

This commit is contained in:
Samuel Philipp 2019-10-27 20:35:10 +01:00
parent 5d05b18b67
commit d4f8e8c85f
22 changed files with 8432 additions and 154 deletions

29
src/js/main.js Normal file
View file

@ -0,0 +1,29 @@
const developer = document.getElementById('developer');
const magician = document.getElementById('magician');
const links = document.getElementById('links');
document.addEventListener('touchmove', function (event) {
event.preventDefault();
var e = event.touches[0];
move(e);
});
document.addEventListener('mousemove', function (event) {
event.preventDefault();
move(event);
});
function move(event) {
let body = document.getElementsByTagName('body')[0];
const width = window.innerWidth || document.documentElement.clientWidth || body.clientWidth;
const height= window.innerHeight|| document.documentElement.clientHeight|| body.clientHeight;
const traX = (((50 * event.pageX) / width)) - 50;
const traY = (((50 * event.pageY) / height)) - 50;
const traX2 = (50 + traX) * -1;
const traY2 = (50 + traY) * -1;
magician.style.left = traX + 'px';
magician.style.top = traY + 'px';
links.style.left = traX + 'px';
links.style.top = traY + 'px';
developer.style.left = traX2 + 'px';
developer.style.top = traY2 + 'px';
}