I'm currently in the process of replicating a demo template found at using scroll effects and mouse location tracking within nextjs/typescript.
While troubleshooting, I encountered an issue with horizontal scrolling that can be resolved by adding overflow:hidden to the section tags - however, this breaks any sticky content interactions.
Unfortunately, I haven't come across any examples on how to accurately recreate these actions, and I'm unsure about the process of manipulating styles/dom to achieve the effect correctly.
I've started developing a function to manipulate these elements, but I'm uncertain about how to bind it and animate it effectively based on mouse events.
Upon loading, there is a title animation where the text enlarges, shrinks, and then returns to its original size https://i.sstatic.net/6Hndg4yB.png
The side rings are rotating https://i.sstatic.net/rE1dV3hk.png https://i.sstatic.net/cw8J8qPg.png
// Hero Section
const Hero = () => {
React.useEffect(() => {
var ellipseLeft = document.querySelector(".ellipse-left");
var ellipseRight = document.querySelector(".ellipse-right");
var rotateZ = 23;
setInterval(() => {
rotateZ++;
ellipseRight.style.transform =
"translate3d(0px, 0px, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(" +
rotateZ +
"deg) skew(0deg, 0deg)";
ellipseRight.style["transform-style"] = "preserve-3d";
ellipseRight.style["will-change"] = "transform";
ellipseLeft.style.transform =
"translate3d(0px, 0px, 0px) scale3d(1, 1, 1) rotateX(0deg) rotateY(0deg) rotateZ(" +
rotateZ +
"deg) skew(0deg, 0deg)";
ellipseLeft.style["transform-style"] = "preserve-3d";
ellipseLeft.style["will-change"] = "transform";
}, 50);
}, []);
During scrolling, the phone unlocks and text moves using parallax https://i.sstatic.net/QvxkmOnZ.png
Check out the project on: https://codesandbox.io/p/sandbox/fervent-fast-forked-wcsmh4
As elements are revealed for the first time, they fade in smoothly https://i.sstatic.net/F55YDgVo.png
Additionally, there is a contrast transition from light to dark within this section which changes based on scroll direction and speed https://i.sstatic.net/BH5NWT2z.png