Added basic scroll animations

This commit is contained in:
blake committed 2025-10-20 14:23:07 -05:00
1 parent 76546ba1c6
commit eb6c251eb9
7 files changed
+79 -29

No files matched your search

+32 -1
View File
@@ -227,6 +227,7 @@ p {
width: 15rem;
}
/* Element styles */
.hero-section {
margin-bottom: 30rem;
height: 100vh;
@@ -273,7 +274,7 @@ p {
border: 3px solid #2d54c7;
border-radius: 20px;
padding: 5rem;
transition: all 0.3s;
transition: transform 0.3s;
height: 100%;
width: 100%;
}
@@ -636,3 +637,33 @@ p {
.yellow-border:hover {
box-shadow: 0 1rem 1rem 0 #ffe642 !important;
}
/* Animations */
.animate-on-scroll {
opacity: 0;
transform: translateY(3rem);
transition-property: opacity, transform;
transition-duration: 0.5s;
transition-timing-function: ease;
transition-delay: 0s;
}
.animate-on-scroll.visible {
opacity: 1;
transform: translateY(0);
}
.animate-on-scroll-delay {
opacity: 0;
transform: translateY(3rem);
transition-property: opacity, transform;
transition-duration: 0.5s;
transition-timing-function: ease;
transition-delay: 0.2s;
}
.animate-on-scroll-delay.visible {
opacity: 1;
transform: translateY(0);
}
+5 -5
View File
@@ -142,7 +142,7 @@
</section>
<section class="contact-section" id="contact">
<div class="heading-wrapper">
<div class="heading-wrapper animate-on-scroll">
<img
class="heading-icon"
src="img/icons/chat.svg"
@@ -150,18 +150,18 @@
/>
<h2>Contact Me</h2>
</div>
<p class="heading-sub">
<p class="heading-sub animate-on-scroll">
Let’s connect! Whether you have a quick question, need a custom quote,
or just want to discuss ideas, feel free to reach out. Drop me a
message through the form, email, or phone, and I’ll get back to you
promptly so we can start building something great together.
</p>
<div class="contact-grid">
<div class="contact-grid animate-on-scroll">
<div class="contact-img">
<img src="img/rocket-launch.svg" alt="rocket taking off" />
</div>
<form
class="contact-form"
class="contact-form animate-on-scroll"
name="contact"
action="https://formbold.com/s/67LMK"
method="POST"
@@ -201,7 +201,7 @@
<button type="submit" class="btn btn-form">Send Message</button>
</form>
</div>
<div class="social-links">
<div class="social-links animate-on-scroll">
<div class="social-icon-wrapper">
<a
href="https://www.facebook.com/cosmicallycreative"
+12 -11
View File
@@ -20,6 +20,7 @@
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/queries.css" />
<link rel="stylesheet" href="css/animations.css" />
<title>
Cosmically Creative &dash; Custom Web Design & Development with HTML, CSS
@@ -68,18 +69,18 @@
</section>
<section class="services-section" id="services">
<div class="heading-wrapper">
<div class="heading-wrapper animate-on-scroll">
<img class="heading-icon" src="img/icons/star.svg" alt="star icon" />
<h2>Your Brand, Written in the Stars</h2>
</div>
<p>
<p class="animate-on-scroll">
My services put your brand into the spotlight with beautiful,
user-friendly websites that captivate your audience. I will ensure
your online presence shines with your brand’s unique personality. With
the power of HTML, CSS, and JavaScript, the sky is the limit for what
we can build together!
</p>
<div class="services-grid">
<div class="services-grid animate-on-scroll">
<a class="services-link" href="web-design.html"
><div class="service-card">
<div class="service-card-header">
@@ -170,7 +171,7 @@
<section class="about-section" id="about">
<div class="about-content">
<div class="heading-wrapper">
<div class="heading-wrapper animate-on-scroll">
<img
class="heading-icon"
src="img/icons/person.svg"
@@ -178,7 +179,7 @@
/>
<h2>About Me</h2>
</div>
<div class="about-wrapper">
<div class="about-wrapper animate-on-scroll">
<div class="about-picture"></div>
<p>
Hi! I’m Blake, the creative mind behind Cosmically Creative, based
@@ -204,7 +205,7 @@
</section>
<section class="project-section">
<div class="heading-wrapper">
<div class="heading-wrapper animate-on-scroll">
<img
class="heading-icon"
src="img/icons/hammer.svg"
@@ -213,7 +214,7 @@
<h2>Past Projects</h2>
</div>
<img class="astronaut" src="img/astronaut.webp" alt="astronaut" />
<div class="project-grid">
<div class="project-grid animate-on-scroll">
<a
href="https://ten8locker.com"
target="_blank"
@@ -258,7 +259,7 @@
</section>
<section class="contact-section" id="contact">
<div class="heading-wrapper">
<div class="heading-wrapper animate-on-scroll">
<img
class="heading-icon"
src="img/icons/chat.svg"
@@ -266,13 +267,13 @@
/>
<h2>Contact Me</h2>
</div>
<p class="heading-sub">
<p class="heading-sub animate-on-scroll">
Let’s connect! Whether you have a quick question, need a custom quote,
or just want to discuss ideas, feel free to reach out. Drop me a
message through the form, email, or phone, and I’ll get back to you
promptly so we can start building something great together.
</p>
<div class="contact-grid">
<div class="contact-grid animate-on-scroll">
<div class="contact-img">
<img src="img/rocket-launch.svg" alt="rocket taking off" />
</div>
@@ -317,7 +318,7 @@
<button type="submit" class="btn btn-form">Send Message</button>
</form>
</div>
<div class="social-links">
<div class="social-links animate-on-scroll">
<div class="social-icon-wrapper">
<a
href="https://www.facebook.com/cosmicallycreative"
+18
View File
@@ -7,3 +7,21 @@ const headerEl = document.querySelector(".header");
btnNavEl.addEventListener("click", function () {
headerEl.classList.toggle("nav-open");
});
// Scroll Animations
document.addEventListener("DOMContentLoaded", () => {
const observerOptions = { root: null, rootMargin: "0px", threshold: 0.5 };
const onIntersection = (entries, observer) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.classList.add("visible");
observer.unobserve(entry.target);
}
});
};
const observer = new IntersectionObserver(onIntersection, observerOptions);
const elementsToAnimate = document.querySelectorAll(
".animate-on-scroll, .animate-on-scroll-delay"
);
elementsToAnimate.forEach((el) => observer.observe(el));
});
+4 -4
View File
@@ -131,7 +131,7 @@
</section>
<section class="contact-section" id="contact">
<div class="heading-wrapper">
<div class="heading-wrapper animate-on-scroll">
<img
class="heading-icon"
src="img/icons/chat.svg"
@@ -139,13 +139,13 @@
/>
<h2>Contact Me</h2>
</div>
<p class="heading-sub">
<p class="heading-sub animate-on-scroll">
Let’s connect! Whether you have a quick question, need a custom quote,
or just want to discuss ideas, feel free to reach out. Drop me a
message through the form, email, or phone, and I’ll get back to you
promptly so we can start building something great together.
</p>
<div class="contact-grid">
<div class="contact-grid animate-on-scroll">
<div class="contact-img">
<img src="img/rocket-launch.svg" alt="rocket taking off" />
</div>
@@ -190,7 +190,7 @@
<button type="submit" class="btn btn-form">Send Message</button>
</form>
</div>
<div class="social-links">
<div class="social-links animate-on-scroll">
<div class="social-icon-wrapper">
<a
href="https://www.facebook.com/cosmicallycreative"
+4 -4
View File
@@ -141,7 +141,7 @@
</section>
<section class="contact-section" id="contact">
<div class="heading-wrapper">
<div class="heading-wrapper animate-on-scroll">
<img
class="heading-icon"
src="img/icons/chat.svg"
@@ -149,13 +149,13 @@
/>
<h2>Contact Me</h2>
</div>
<p class="heading-sub">
<p class="heading-sub animate-on-scroll">
Let’s connect! Whether you have a quick question, need a custom quote,
or just want to discuss ideas, feel free to reach out. Drop me a
message through the form, email, or phone, and I’ll get back to you
promptly so we can start building something great together.
</p>
<div class="contact-grid">
<div class="contact-grid animate-on-scroll">
<div class="contact-img">
<img src="img/rocket-launch.svg" alt="rocket taking off" />
</div>
@@ -200,7 +200,7 @@
<button type="submit" class="btn btn-form">Send Message</button>
</form>
</div>
<div class="social-links">
<div class="social-links animate-on-scroll">
<div class="social-icon-wrapper">
<a
href="https://www.facebook.com/cosmicallycreative"
+4 -4
View File
@@ -153,7 +153,7 @@
</section>
<section class="contact-section" id="contact">
<div class="heading-wrapper">
<div class="heading-wrapper animate-on-scroll">
<img
class="heading-icon"
src="img/icons/chat.svg"
@@ -161,13 +161,13 @@
/>
<h2>Contact Me</h2>
</div>
<p class="heading-sub">
<p class="heading-sub animate-on-scroll">
Let’s connect! Whether you have a quick question, need a custom quote,
or just want to discuss ideas, feel free to reach out. Drop me a
message through the form, email, or phone, and I’ll get back to you
promptly so we can start building something great together.
</p>
<div class="contact-grid">
<div class="contact-grid animate-on-scroll">
<div class="contact-img">
<img src="img/rocket-launch.svg" alt="rocket taking off" />
</div>
@@ -212,7 +212,7 @@
<button type="submit" class="btn btn-form">Send Message</button>
</form>
</div>
<div class="social-links">
<div class="social-links animate-on-scroll">
<div class="social-icon-wrapper">
<a
href="https://www.facebook.com/cosmicallycreative"