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