Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

applingcahnges for smoothness of the page #5310

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sections/FeatureHero/featureHero.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const FeatureHeroWrapper = styled.div`
}

#whiteboard-svg {
transition: transform 0.3s ease-out;
transition: transform 0.3s ease-out, opacity 0.3s ease-out; // Add opacity transition
transform-origin: bottom center;
transform: rotateX(12deg);
}
Expand Down
8 changes: 5 additions & 3 deletions src/sections/FeatureHero/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ import React, { useEffect } from "react";
import FeatureHeroWrapper from "./featureHero.style";
import { Container } from "../../reusecore/Layout";
import Button from "../../reusecore/Button";

const FeatureHero = (props) => {
useEffect(() => {
const scrollingImage = document.getElementById("whiteboard-svg");

const handleScroll = () => {
const scrollPosition = window.scrollY;
const translateY = scrollPosition / 16;
const finalRotateAngle = Math.min(translateY, 12);
scrollingImage.style.transform = `rotateX(${12 - finalRotateAngle}deg)`;
const translateY = scrollPosition / 8;
let finalRotateAngle = Math.max(12 - translateY, 0);

scrollingImage.style.transform = `rotateX(${finalRotateAngle}deg)`;
};

window.addEventListener("scroll", handleScroll);
Expand Down