Skip to content

Commit

Permalink
fixed landing page squares
Browse files Browse the repository at this point in the history
  • Loading branch information
ZintisMay committed Mar 22, 2024
1 parent d832ea6 commit 8a1ce78
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 235 deletions.
73 changes: 0 additions & 73 deletions contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,78 +41,5 @@ <h1 class="headerText">Contact Me</h1>
<script src="data/contactData.js"></script>

<script src="addMenu.js"></script>
<script>

let blueSquareWithContent = document.querySelectorAll(".contentArea .blueSquare")
// alert(blueSquareWithContent.length)
for (let x = 0; x < blueSquareWithContent.length; x++) {
let target = blueSquareWithContent[x]
target.position = "absolute"
target.style.top = `calc(40% + ${x * 50}px)`
if (x % 2 === 1) {
target.style.margin = "0 calc(50% + 150px)"
} else {
target.style.margin = "0 calc(50% - 150px)"
}
}

let blueSquareArray = createShapes(10)
blueSquareArray.forEach(tri => {
contentArea.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, distanceFromTB, distanceFromLR) {
var heightWidth = rand(50, 100);
let tri = document.createElement("div")
tri.classList.add("blueSquare")
tri.style.zIndex = 0
tri.style.top = rand(distanceFromTB.lo, distanceFromTB.hi) + "%"
tri.style.left = 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, { lo: 15, hi: 100 }, { lo: -5, hi: 0 }))
}
// right
for (var y = 0; y < amount; y++) {
blueSquareArray.push(makeRandomBlueSquare(x, { lo: 15, hi: 100 }, { lo: 100, hi: 105 }))
}
// // top
// for (var z = 0; z < amount; z++) {
// blueSquareArray.push(makeRandomBlueSquare(x, { lo: -3, hi: 5 }, { lo: 10, hi: 90 }))
// }
// // bottom
// for (var q = 0; q < amount; q++) {
// blueSquareArray.push(makeRandomBlueSquare(x, { lo: 97, hi: 103 }, { lo: -10, hi: 100 }))
// }
return blueSquareArray
}
</script>

</html>
73 changes: 0 additions & 73 deletions games.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,78 +54,5 @@ <h3>
}
</script>
<script src="addMenu.js"></script>
<script>

let blueSquareWithContent = document.querySelectorAll(".contentArea .blueSquare")
// alert(blueSquareWithContent.length)
for (let x = 0; x < blueSquareWithContent.length; x++) {
let target = blueSquareWithContent[x]
target.position = "absolute"
target.style.top = `calc(40% + ${x * 50}px)`
if (x % 2 === 1) {
target.style.margin = "0 calc(50% + 150px)"
} else {
target.style.margin = "0 calc(50% - 150px)"
}
}

let blueSquareArray = createShapes(10)
blueSquareArray.forEach(tri => {
contentArea.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, distanceFromTB, distanceFromLR) {
var heightWidth = rand(50, 100);
let tri = document.createElement("div")
tri.classList.add("blueSquare")
tri.style.zIndex = 0
tri.style.top = rand(distanceFromTB.lo, distanceFromTB.hi) + "%"
tri.style.left = 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, { lo: 15, hi: 100 }, { lo: -5, hi: 0 }))
}
// right
for (var y = 0; y < amount; y++) {
blueSquareArray.push(makeRandomBlueSquare(x, { lo: 15, hi: 100 }, { lo: 100, hi: 105 }))
}
// // top
// for (var z = 0; z < amount; z++) {
// blueSquareArray.push(makeRandomBlueSquare(x, { lo: -3, hi: 5 }, { lo: 10, hi: 90 }))
// }
// // bottom
// for (var q = 0; q < amount; q++) {
// blueSquareArray.push(makeRandomBlueSquare(x, { lo: 97, hi: 103 }, { lo: -10, hi: 100 }))
// }
return blueSquareArray
}
</script>

</html>
13 changes: 0 additions & 13 deletions home.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,6 @@ <h1>Zintis May</h1>
</script>
<script>

let blueSquareWithContent = document.querySelectorAll(".contentArea .blueSquare")
// alert(blueSquareWithContent.length)
for (let x = 0; x < blueSquareWithContent.length; x++) {
let target = blueSquareWithContent[x]
target.position = "absolute"
target.style.top = `calc(40% + ${x * 50}px)`
if (x % 2 === 1) {
target.style.margin = "0 calc(50% + 150px)"
} else {
target.style.margin = "0 calc(50% - 150px)"
}
}

let blueSquareArray = createShapes(10)
let contentArea = document.getElementById("contentArea")
blueSquareArray.forEach(tri => {
Expand Down
11 changes: 8 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
<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)
Expand All @@ -54,14 +59,14 @@
}

function makeRandomblueSquare(i, topBottom, distanceFromTB, leftRight, distanceFromLR) {
var heightWidth = rand(10, 20);
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 + "vw"
tri.style.width = heightWidth + "vw"
tri.style.height = heightWidth + "px"
tri.style.width = heightWidth + "px"
tri.style.opacity = weightedRand(10, 70, false, 3) / 100

return tri
Expand Down
73 changes: 0 additions & 73 deletions work.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,78 +54,5 @@ <h3>
}
</script>
<script src="addMenu.js"></script>
<script>

let blueSquareWithContent = document.querySelectorAll(".contentArea .blueSquare")
// alert(blueSquareWithContent.length)
for (let x = 0; x < blueSquareWithContent.length; x++) {
let target = blueSquareWithContent[x]
target.position = "absolute"
target.style.top = `calc(40% + ${x * 50}px)`
if (x % 2 === 1) {
target.style.margin = "0 calc(50% + 150px)"
} else {
target.style.margin = "0 calc(50% - 150px)"
}
}

let blueSquareArray = createShapes(10)
blueSquareArray.forEach(tri => {
contentArea.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, distanceFromTB, distanceFromLR) {
var heightWidth = rand(50, 100);
let tri = document.createElement("div")
tri.classList.add("blueSquare")
tri.style.zIndex = 0
tri.style.top = rand(distanceFromTB.lo, distanceFromTB.hi) + "%"
tri.style.left = 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, { lo: 15, hi: 100 }, { lo: -5, hi: 0 }))
}
// right
for (var y = 0; y < amount; y++) {
blueSquareArray.push(makeRandomBlueSquare(x, { lo: 15, hi: 100 }, { lo: 100, hi: 105 }))
}
// // top
// for (var z = 0; z < amount; z++) {
// blueSquareArray.push(makeRandomBlueSquare(x, { lo: -3, hi: 5 }, { lo: 10, hi: 90 }))
// }
// // bottom
// for (var q = 0; q < amount; q++) {
// blueSquareArray.push(makeRandomBlueSquare(x, { lo: 97, hi: 103 }, { lo: -10, hi: 100 }))
// }
return blueSquareArray
}
</script>

</html>

0 comments on commit 8a1ce78

Please sign in to comment.