Skip to content

Commit

Permalink
Animando
Browse files Browse the repository at this point in the history
  • Loading branch information
fvandrad committed Jan 6, 2025
1 parent 04287f3 commit dcde1d7
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 4 deletions.
25 changes: 25 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,28 @@ document.addEventListener('DOMContentLoaded', () => {

// Lightbox functionality can be added here
});

document.addEventListener('DOMContentLoaded', function() {
const options = {
root: null,
rootMargin: '0px',
threshold: 0.1
};

const observer = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animated');
observer.unobserve(entry.target); // Stop observing once animated
}
});
}, options);

// Select elements to animate
const elements = document.querySelectorAll('.about-text, .about-image, .card, .gallery-item, .testimonial-card');

elements.forEach(element => {
element.classList.add('animate-on-scroll');
observer.observe(element);
});
});
74 changes: 70 additions & 4 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
html {
scroll-behavior: smooth;
overflow-x: hidden;
width: 100%;
width: 100vw;
}

body {
Expand Down Expand Up @@ -121,7 +121,7 @@ body {
align-items: center;
justify-content: center;
padding: 20px;
animation: fadeScale 1.2s cubic-bezier(0.4, 0, 0.2, 1);
animation: fadeIn 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-content {
Expand All @@ -132,7 +132,7 @@ body {
display: flex;
flex-direction: column;
align-items: center;
animation: floatUp 1.5s cubic-bezier(0.4, 0, 0.2, 1);
animation: fadeIn 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

iframe {
Expand Down Expand Up @@ -706,4 +706,70 @@ iframe {

.footer a:hover {
color: var(--color-cyan);
}
}

@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

.animate-on-scroll {
opacity: 0;
}

.animate-on-scroll.animated {
animation: fadeInUp 0.8s ease-out forwards;
}

.animate-on-scroll.animated {
animation: fadeInUp 0.8s ease-out forwards;
}

/* Add stagger delay for cards */
.card.animated:nth-child(1) { animation-delay: 0.1s; }
.card.animated:nth-child(2) { animation-delay: 0.2s; }
.card.animated:nth-child(3) { animation-delay: 0.3s; }
.card.animated:nth-child(4) { animation-delay: 0.4s; }

/* Add stagger delay for gallery items */
.gallery-item.animated:nth-child(1) { animation-delay: 0.1s; }
.gallery-item.animated:nth-child(2) { animation-delay: 0.2s; }
.gallery-item.animated:nth-child(3) { animation-delay: 0.3s; }
/* Add more if needed */

@keyframes fadeInLeft {
from {
opacity: 0;
transform: translateX(-30px);
}
to {
opacity: 1;
transform: translateX(0);
}
}

@keyframes fadeInRight {
from {
opacity: 0;
transform: translateX(30px);
}
to {
opacity: 1;
transform: translateX(0);
}
}

/* Apply different animations to different elements */
.about-text.animated {
animation: fadeInLeft 0.8s ease-out forwards;
}

.about-image.animated {
animation: fadeInRight 0.8s ease-out forwards;
}

0 comments on commit dcde1d7

Please sign in to comment.