Skip to content

Commit

Permalink
asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
royalfig committed Jul 10, 2023
1 parent 79a042a commit cf6e2fc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
5 changes: 3 additions & 2 deletions assets/css/components/card.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
color: #fff;
border-radius: var(--radius);
opacity: 0;
transition: opacity 0.35s linear;
transition: opacity 0.5s linear;
}

@supports (prefers-reduced-motion: reduce) {
Expand Down Expand Up @@ -251,7 +251,7 @@
background-color: var(--surface-light);
border-radius: var(--radius);
opacity: 0;
transition: opacity 0.35s linear;
transition: opacity 0.5s linear;
}

@media (--tablet) {
Expand Down Expand Up @@ -287,4 +287,5 @@

.sm-observed {
opacity: 1;
transition: opacity 0.5s cubic-bezier(0.075, 0.82, 0.165, 1);
}
19 changes: 12 additions & 7 deletions assets/js/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,23 @@ function animateOnScroll() {
const el = entry.target;
const ratio = entry.intersectionRatio;

if (ratio > 0.5) {
// remove from observation
el.classList.add('sm-observed');
observer.unobserve(el);
}
// if (ratio > 0.5) {
// // remove from observation

// el.classList.add('sm-observed');
// observer.unobserve(el);
// }

const calculatedRatio = (num) => {
if (num < 0.25) {
if (num < 0.2) {
return 0;
}

return 1;
if (num >= 0.4) {
return 1;
}

return ratio;
};
el.style.opacity = calculatedRatio(ratio);
});
Expand Down

0 comments on commit cf6e2fc

Please sign in to comment.