-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
103 lines (88 loc) · 2.96 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Zintis May</title>
<link rel="stylesheet" href="robotoFont.css">
<link rel="stylesheet" href="robotoFont.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="index.css">
<style>
body {
overflow: hidden;
margin: 0;
padding: 0;
}
</style>
</head>
<body class="index">
<div id="shapeHolder" class="sidePattern">
</div>
<a href="home.html" class="fancyZ fixedCenter"></a>
</body>
<script>
document.body.addEventListener("click", function () {
window.location = "home.html"
})
</script>
<script>
let blueSquareArray = createShapes(10)
let shapeHolder = document.getElementById("shapeHolder")
blueSquareArray.forEach(tri => {
shapeHolder.appendChild(tri)
})
function rand(min, max) {
return min + Math.floor(Math.random() * Math.floor(max - min + 1));
}
function weightedRand(min, max, goHi, iterations) {
var numToReturn = max;
for (var k = 0; k < iterations; k++) {
var randomNumber = rand(min, max);
if (goHi && randomNumber > numToReturn) {
numToReturn = randomNumber
} else if (!goHi && randomNumber < numToReturn) {
numToReturn = randomNumber
}
}
return numToReturn;
}
function makeRandomblueSquare(i, topBottom, distanceFromTB, leftRight, distanceFromLR) {
var heightWidth = rand(75, 150);
let tri = document.createElement("div")
tri.classList.add("blueSquare")
tri.style.zIndex = 0
if (topBottom) tri.style[topBottom] = rand(distanceFromTB.lo, distanceFromTB.hi) + "%"
if (leftRight) tri.style[leftRight] = rand(distanceFromLR.lo, distanceFromLR.hi) + "%"
tri.style.height = heightWidth + "px"
tri.style.width = heightWidth + "px"
tri.style.opacity = weightedRand(10, 70, false, 3) / 100
return tri
}
function createShapes(amount) {
//Version 1 sides
var blueSquareArray = []
// left
for (var x = 0; x < amount; x++) {
blueSquareArray.push(makeRandomblueSquare(x, "top", { lo: -5, hi: 105 }, "left", { lo: -3, hi: 3 }))
}
// right
for (var y = 0; y < amount; y++) {
blueSquareArray.push(makeRandomblueSquare(x, "top", { lo: -5, hi: 105 }, "left", { lo: 97, hi: 103 }))
}
// top
for (var z = 0; z < amount; z++) {
blueSquareArray.push(makeRandomblueSquare(x, "top", { lo: -3, hi: 3 }, "left", { lo: -5, hi: 105 }))
}
// bottom
for (var q = 0; q < amount; q++) {
blueSquareArray.push(makeRandomblueSquare(x, "top", { lo: 97, hi: 103 }, "left", { lo: -5, hi: 105 }))
}
return blueSquareArray
}
</script>
</html>