Fix header

This reverts commit 9da32e5d17.
This commit is contained in:
gidsi 2018-10-13 23:07:34 +02:00
parent 630451a551
commit d40664595e
No known key found for this signature in database
GPG Key ID: B47291090A6E5604
1 changed files with 18 additions and 2 deletions

View File

@ -114,19 +114,35 @@
// animation
function initAnimation() {
animate();
for(var i in points) {
shiftPoint(points[i]);
}
}
function animate() {
if(animateHeader) {
ctx.clearRect(0,0,width,height);
for(var i in points) {
points[i].active = 0.3;
points[i].circle.active = 0.6;
// detect points in range
if(Math.abs(getDistance(target, points[i])) < 4000) {
points[i].active = 0.3;
points[i].circle.active = 0.6;
} else if(Math.abs(getDistance(target, points[i])) < 20000) {
points[i].active = 0.1;
points[i].circle.active = 0.3;
} else if(Math.abs(getDistance(target, points[i])) < 40000) {
points[i].active = 0.02;
points[i].circle.active = 0.1;
} else {
points[i].active = 0;
points[i].circle.active = 0;
}
drawLines(points[i]);
points[i].circle.draw();
}
}
requestAnimationFrame(animate);
}
function shiftPoint(p) {