Skip to content

Commit eaedc11

Browse files
committed
updated header animation
1 parent 49aec33 commit eaedc11

4 files changed

Lines changed: 158 additions & 8 deletions

File tree

‎_includes/home_header.html‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
</div> -->
2222

2323
<div class="header-bg">
24-
{% include svg/header-bg2.svg %}
24+
<svg xmlns="http://www.w3.org/2000/svg">
25+
</svg>
2526
</div>
2627

2728

‎_sass/home/_header.scss‎

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@
6969

7070
.header-bg {
7171
position: absolute;
72-
bottom: 0;
72+
top: 0;
7373
width: 100%;
74+
height: 100%;
7475

7576
background-position: center;
7677
-webkit-background-size: cover;
@@ -82,9 +83,11 @@
8283
z-index: 0;
8384

8485
svg {
85-
width: 90%;
86-
height: 90%;
86+
width: 100%;
87+
height: 100%;
8788
}
89+
90+
8891
}
8992

9093
.slot {
@@ -432,5 +435,58 @@
432435
@keyframes parts2 {
433436
0% { opacity: 0.15; }
434437
50% { opacity: 0.20; }
435-
100% { opacity: 0.15; }
436-
}
438+
100% { opacity: 0.15; }
439+
}
440+
441+
442+
// new
443+
444+
.header-bg svg rect {
445+
// opacity: 0.0;
446+
z-index: 0;
447+
448+
// animation-duration: 6s;
449+
animation-iteration-count: infinite;
450+
}
451+
452+
453+
// l1
454+
.header-bg svg .box1 {
455+
animation-name: box1;
456+
animation-delay: 0.0s;
457+
animation-duration: 6s;
458+
}
459+
460+
.header-bg svg .box2 {
461+
animation-name: box2;
462+
animation-delay: 1s;
463+
animation-duration: 6s;
464+
}
465+
466+
.header-bg svg rect {
467+
animation-name: box3;
468+
animation-delay: 2s;
469+
animation-duration: 6s;
470+
}
471+
472+
473+
@keyframes box1 {
474+
0% { fill: #fff; }
475+
50% { fill: #56c69f; }
476+
100% { fill: #fff; }
477+
}
478+
479+
@keyframes box2 {
480+
0% { fill: #fff; }
481+
50% { fill: #56c69f; }
482+
100% { fill: #fff; }
483+
}
484+
485+
@keyframes box3 {
486+
0% { fill: #fff; }
487+
50% { fill: #56c69f; }
488+
100% { fill: #fff; }
489+
}
490+
491+
492+

‎assets/js/banneranimation.js‎

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,96 @@
11
---
22
---
33

4+
// variable for the namespace
5+
const svgns = "http://www.w3.org/2000/svg";
6+
7+
// targeting the svg itself
8+
const svg = document.querySelector(".header-bg svg");
9+
10+
11+
let opacities = [ 0.0, 0.05, 0.1, 0.15 ];
12+
// let opacities = [ 0.0, 0.025, 0.05, 0.075 ];
13+
// let opacities = [ 0.025, 0.05, 0.075, 0.1, 0.125, 0.15, 0.175, 0.20, 0.225, 0.25 ];
14+
15+
for(let i = 0; i < 10; i++) {
16+
for(let j = 0; j < 10; j++) {
17+
let newRect = document.createElementNS(svgns, "rect");
18+
newRect.setAttribute("x", "" + i*10 + "%");
19+
newRect.setAttribute("y", "" + j*10 + "%");
20+
newRect.setAttribute("width", "10%");
21+
newRect.setAttribute("height", "10%");
22+
newRect.setAttribute("fill", "#ffffff");
23+
newRect.setAttribute("opacity", "" + opacities[getRndInteger(0, 4)]);
24+
25+
newRect.setAttribute("id", "x" + i + "y" + j);
26+
svg.appendChild(newRect);
27+
}
28+
}
29+
getGridMapping();
30+
31+
function getGridMapping() {
32+
33+
34+
for(let i = 0; i < 10; i++) {
35+
for(let j = 0; j < 10; j++) {
36+
let rect = document.getElementById("x" + i + "y" + j);
37+
rect.setAttribute("class", "");
38+
}
39+
}
40+
41+
42+
let luX, luY, ruX, ruY, rdX, rdY, ldX, ldY;
43+
luX = getRndInteger(3, 6);
44+
luY = getRndInteger(3, 6);
45+
ruX = luX + 2;
46+
ruY = luY;
47+
rdX = ruX;
48+
rdY = ruY + 2;
49+
ldX = luX;
50+
ldY = rdY;
51+
52+
53+
for(let i = luX; i < ruX; i++) {
54+
for(let j = luY; j < ldY; j++) {
55+
let rect = document.getElementById("x" + i + "y" + j);
56+
rect.setAttribute("class", "box1");
57+
}
58+
}
59+
60+
for(let i = luX-1; i < ruX+1; i++) {
61+
for(let j = luY-1; j < ldY+1; j++) {
62+
let rect = document.getElementById("x" + i + "y" + j);
63+
if(rect.getAttribute("class") != "box1") {
64+
rect.setAttribute("class", "box2");
65+
}
66+
}
67+
}
68+
69+
70+
// let level = 1;
71+
// let box = 1;
72+
// for(let i = 0; i < 3; i++) {
73+
// box = 1;
74+
// for(let j = 0; j < 3; j++) {
75+
// let rect = document.getElementById("x" + i + "y" + j);
76+
// rect.setAttribute("class", "l" + level + "b" + box);
77+
// }
78+
// box = 2;
79+
// for(let j = 3; j < 6; j++) {
80+
// let rect = document.getElementById("x" + i + "y" + j);
81+
// rect.setAttribute("class", "l" + level + "b" + box);
82+
// }
83+
// box = 2;
84+
// for(let j = 6; j < 10; j++) {
85+
// let rect = document.getElementById("x" + i + "y" + j);
86+
// rect.setAttribute("class", "l" + level + "b" + box);
87+
// }
88+
// }
89+
90+
}
91+
92+
function getRndInteger(min, max) {
93+
return Math.floor(Math.random() * (max - min) ) + min;
94+
}
95+
96+

‎assets/js/map.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
---
33

4-
(function($) {
4+
(function(L) {
55

66

77
var map = L.map('map').setView([48.36936535443323, 14.513704089483294], 15);
@@ -41,4 +41,4 @@
4141
+ '<br/><br/><a target="_blank" href="https://www.openstreetmap.org/directions?from=&to=48.37046%2C14.51391">Route hierhin</a>');
4242

4343

44-
})(jQuery);
44+
})(L);

0 commit comments

Comments
 (0)