Skip to content

Commit

Permalink
optimized and customized
Browse files Browse the repository at this point in the history
optimized page speed and page and made few tweaks and customized scroll bar, logo, cursor
  • Loading branch information
lisztomania23 committed Nov 11, 2023
1 parent 80f8a2f commit 4a41575
Show file tree
Hide file tree
Showing 8 changed files with 488 additions and 227 deletions.
Binary file added img/astronaut_cursor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/astronaut_cursor_hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/space-colony.webp
Binary file not shown.
42 changes: 27 additions & 15 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="google-site-verification" content="pjXiEN1phAVdFRW2uJDdjLIgKpPwZxwBn7nDnRjKZUk" />
<meta name="author" content="Rahul Raj (lisztomania23)">

<link rel="icon" type="image/webp" size="32x32" href="./img/cosmezis_logo.webp" alt="">

<link rel="icon" type="image/webp" size="32x32" href="./img/cosmezis_logo.webp" alt="cosmezis logo">
<link
href="https://fonts.googleapis.com/css2?family=Kufam&family=Mouse+Memoirs&family=Nunito:wght@200;300&display=swap"
rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Kufam&family=Mouse+Memoirs&family=Nunito:wght@200;300&display=swap">
<link rel="stylesheet" href="style.css">

<script defer src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script defer src="app.js"></script>
<!-- <script defer src="https://code.jquery.com/jquery-3.6.0.min.js"></script> -->
<script src="xo.js"></script>
<script defer src="script.js"></script>
<title>cosmezis</title>
</head>

Expand All @@ -33,10 +36,12 @@

<section class="hero">

<div class="star"><canvas id="c"></canvas></div>
<!-- <video autoplay loop muted playsinline class="hero_video"> -->
<div class="star"><canvas id="space"></canvas></div>

<!-- <video autoplay loop muted playsinline class="hero_video">
<source src="vid/by-Timo-Herbert-from-Pixabay.mp4" type="video/mp4">
</video>
</video> -->

<div class="hero_img"><img class="hiddenhero" src="img/pexels-Photo-by-Kristaps.webp"
alt="ExoTerra drone for navigation and exploration"></div>
<h1 class="hero_text hidden-hero-text">TOUCH NEW HORIZONS</h1>
Expand Down Expand Up @@ -80,9 +85,14 @@ <h3>500+</h3>
</div>
</section>
<section class="about" id="about_us">
<video autoplay loop muted playsinline class="about_video">
<source src="vid/by-9991096-from-Pixabay.mp4" type="video/mp4">
<video autoplay loop muted playsinline class="about_video" loading="lazy">
<source src="vid/by-Chot-Studio-from-Vecteezy.mp4" type="video/mp4">
</video>

<!-- <div class="matrix">
<matrix></matrix>
</div> -->

<div class="about_text hidden">
<div class="about_bg hidden">
<h2>About Us</h2>
Expand All @@ -109,7 +119,8 @@ <h2 class="mission_h">Our Missions</h2>
<div class="mission_img">
<div class="mission-item">
<div class="img__box">
<img class="hidden" src="img/space-colony.webp" alt="space colony on Seraphix Prime">
<img class="hidden" src="img/space-colony.webp" alt="space colony on Seraphix Prime"
loading="lazy">
</div>
<div class="img-content">
<p class="content__text">
Expand All @@ -121,7 +132,7 @@ <h2 class="mission_h">Our Missions</h2>
<div class="mission-item">
<div class="img__box">
<img class="hidden" src="img/alien-planet.webp"
alt="Towering high flowers of Gardens of Lunaria">
alt="Towering high flowers of Gardens of Lunaria" loading="lazy">
</div>
<div class="img-content">
<p class="content__text">
Expand All @@ -133,7 +144,7 @@ <h2 class="mission_h">Our Missions</h2>
<div class="mission-item">
<div class="img__box">
<img class="hidden" src="img/black-hole-home.webp"
alt="An engineer floating near Nomad's Hope ark">
alt="An engineer floating near Nomad's Hope ark" loading="lazy">
</div>
<div class="img-content">
<p class="content__text">
Expand Down Expand Up @@ -197,6 +208,7 @@ <h2 class="mission_h">Our Missions</h2>
</div>
</div>
</div>

</body>

</html>
</html>
214 changes: 214 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
// Intersection Observer
const observer = new IntersectionObserver((entries) => {
// Iterate through each entry
entries.forEach((entry) => {
console.log(entry);
if (entry.isIntersecting) {
// Add 'show' class when element enters viewport
entry.target.classList.add('show');
entry.target.classList.remove('no-webkit-fill');
if (entry.target.classList.contains('hidden-hero-text')) {
setTimeout(() => {
entry.target.classList.add('no-webkit-fill');
}, 1000);
}
// Stop observing
observer.unobserve(entry.target);
}
});
});

// Select all elements with the specified classes
const hiddenElements = document.querySelectorAll('.hidden, .hidden-hero-text, .hiddenimg, .hiddenhero, .hidden-hero-btn');
// Observe each of these elements
hiddenElements.forEach((el) => observer.observe(el));



// music controls
const main = document.querySelector('main');
let audio;

main.addEventListener('click', function () {
if (!audio) {

audio = new Audio();
audio.id = 'spaceMusic';
main.appendChild(audio);
}

audio.src = "music/after-dark-pandora-cody-chillwithme.mp3";
audio.play();

audio.addEventListener('ended', function () {
audio.src = "music/KQEJO-emphasis.mp3";
audio.play();
});
});



// for modal
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('.btn, .xplore').forEach(function (element) {
element.addEventListener('click', function () {
document.querySelector('.modal-wrapper').classList.add('open');
});
});

document.querySelector('.btn-close').addEventListener('click', function () {
document.querySelector('.modal-wrapper').classList.remove('open');
});

document.querySelector('.modal-wrapper').addEventListener('click', function (event) {
if (event.target === this) {
this.classList.remove('open');
}
});
});



// $(document).ready(function () {
// // Open the modal
// $(".btn, .xplore").click(function () {
// $(".modal-wrapper").addClass("open");
// });

// // Close the modal on clicking the close button
// $(".btn-close").click(function () {
// $(".modal-wrapper").removeClass("open");
// });

// // Close the modal when clicking outside of it
// $(".modal-wrapper").click(function (event) {
// if (event.target === this) {
// $(this).removeClass("open");
// }
// });
// });


// Matrix Rain Animation

// function createMatrixRainAnimation() {
// function r(from, to) {
// return ~~(Math.random() * (to - from + 1) + from);
// }

// function pick() {
// return arguments[r(0, arguments.length - 1)];
// }

// function getChar() {
// return String.fromCharCode(pick(
// r(0x3041, 0x30ff),
// r(0x2000, 0x206f),
// r(0x0020, 0x003f)
// ));
// }

// function loop(fn, delay) {
// let stamp = Date.now();
// function _loop() {
// if (Date.now() - stamp >= delay) {
// fn(); stamp = Date.now();
// }
// requestAnimationFrame(_loop);
// }
// requestAnimationFrame(_loop);
// }

// class Char {
// constructor() {
// this.element = document.createElement('dope');
// this.mutate();
// }
// mutate() {
// this.element.textContent = getChar();
// }
// }

// class Trail {
// constructor(list = [], options) {
// this.list = list;
// this.options = Object.assign(
// { size: 10, offset: 0 }, options
// );
// this.body = [];
// this.move();
// }
// traverse(fn) {
// this.body.forEach((n, i) => {
// let last = (i == this.body.length - 1);
// if (n) fn(n, i, last);
// });
// }
// move() {
// this.body = [];
// let { offset, size } = this.options;
// for (let i = 0; i < size; ++i) {
// let item = this.list[offset + i - size + 1];
// this.body.push(item);
// }
// this.options.offset =
// (offset + 1) % (this.list.length + size - 1);
// }
// }

// class Rain {
// constructor({ target, row }) {
// this.element = document.createElement('p');
// this.build(row);
// if (target) {
// target.appendChild(this.element);
// }
// this.drop();
// }
// build(row = 20) {
// let root = document.createDocumentFragment();
// let chars = [];
// for (let i = 0; i < row; ++i) {
// let c = new Char();
// root.appendChild(c.element);
// chars.push(c);
// if (Math.random() < .5) {
// loop(() => c.mutate(), r(1e3, 5e3));
// }
// }
// this.trail = new Trail(chars, {
// size: r(10, 30), offset: r(0, 100)
// });
// this.element.appendChild(root);
// }
// drop() {
// let trail = this.trail;
// let len = trail.body.length;
// let delay = r(10, 100);
// loop(() => {
// trail.move();
// trail.traverse((c, i, last) => {
// c.element.style = `
// color: hsl(136, 100%, ${85 / len * (i + 1)}%)
// `;
// if (last) {
// c.mutate();
// c.element.style = `
// color: hsl(136, 100%, 85%);
// text-shadow:
// 0 0 .5em #fff,
// 0 0 .5em currentColor;
// `;
// }
// });
// }, delay);
// }
// }

// const matrix = document.querySelector('matrix');
// for (let i = 0; i < 50; ++i) {
// new Rain({ target: matrix, row: 50 });
// }
// }

// createMatrixRainAnimation();
Loading

0 comments on commit 4a41575

Please sign in to comment.