Jump to content
GreenSock

Rodrigo last won the day on September 28

Rodrigo had the most liked content!

Rodrigo

Administrators
  • Posts

    2,316
  • Joined

  • Last visited

  • Days Won

    175

Rodrigo last won the day on September 28

Rodrigo had the most liked content!

7 Followers

About Rodrigo

Profile Information

  • Gender
    Male
  • Location
    Santiago - Chile

Recent Profile Visitors

33,107 profile views
  1. You mean when you scroll or when you click an image? For the scrolling they are using Lenis, it says so in the article: You can achieve the same effect with Smooth Scroller for what is worth, using the native scroll bar.
  2. Hi, The easiest way to achieve that is with ScrollSmoother: https://codepen.io/GreenSock/pen/PoOpobM Also this can be done with ScrollTrigger but is not exactly the same effect: https://codepen.io/GreenSock/pen/QWjjYEw https://codepen.io/GreenSock/pen/rNJQPXz Happy Tweening!
  3. Hi @prestonl and welcome to the GreenSock forums! Do you mean something like this?: https://pixijs.io/examples/#/filters-basic/displacement-map-flag.js If so, then head onto PIXI to find out about the displacement filter. You should use ScrollTrigger's snap functionality and the onEnter callback to start the filter and the a timer to stop the filter from rendering. Happy Tweening!
  4. Hi @maisiemay06 and welcome to the GreenSock forums! Indeed one of the issues is that the elements might not be in the DOM when the code runs, for that you have to check Vue3's composition API lifecycle hooks: https://vuejs.org/api/composition-api-lifecycle.html If you want to include the latest version of Tailwind in codepen, click the gear in the code section and in the sidebar select the HTML section and add this tag: <script src="https://cdn.tailwindcss.com"></script> The reason you're seeing the small amount of vertical scroll is because when the <body> element gets a horizontal scroll with an element that has a 100vh height, it kicks the vertical overflow because of the extra space the horizontal scroll bar needs. Is better to wrap everything inside an element that acts as a wrapper and do the scrolling in that element. In that case you have to provide that information to ScrollTrigger so it knows where the scrolling has to be watched and in which direction. I forked your example and tinkered with the styling using Tailwind and created a rudimentary scroll trigger instance for each image: https://codepen.io/GreenSock/pen/gOzeVZN Finally is worth noticing that this example uses Context, which was introduced in version 3.11 Happy Tweening!
  5. Hi @Eraze86 and welcome to the GreenSock forums! This seems to work the way you expect: https://codesandbox.io/s/quizzical-ardinghelli-qh4x2w?file=/src/App.js Although I'll be more inclined to a setup like this: https://codesandbox.io/s/distracted-water-7mrwr9?file=/src/App.js Happy Tweening!
  6. Hi, This could be related to the fact that things in your local environment are running faster than normal which can be expected though. Have you tried in devtools using network throttling to slow down the local requests and see what happens? I noticed that you're using rather outdated versions of GSAP and ScrollTrigger (3.9.1), you should try to update those in order to see what happens. Also I'm curious about those conditional statements you have in your code: if(document.querySelector(".pinnedBgText")){ //... } if (document.querySelector(".formBanner")) { //... } You've always had those in your code or you added them to test things after seeing this issue? I'd like to point out as well that in this code: gsap.to(".formBanner", { scrollTrigger: { trigger: ".formBanner", toggleActions: "play none none reverse", anticipatePin: 1, invalidateOnRefresh: true, start: "top center", endTrigger:"html", end:"bottom top", markers: true, toggleClass: "formBanner--active" }, backgroundColor: gsap.getProperty("html", "--yellow") }); There is no need for anticipatePin or endTrigger, especially since the end trigger is the html tag. If you check the markers you'll notice that the end marker never reaches the top of the viewport and it will never do, since it's the html tag. I doubt those have any effect in your issues, but they could leave to some confusion. Finally have you tried a production build running on a real server or your local machine? Sorry I can't be of more assistance, but since is something that can't be replicated on an editable example this is pretty much all I can think that could be causing the problem. Happy Tweening!
  7. Hi @momo12, I'm not sure I fully understand what you're trying to do. Does this works the way you intend?: function flipmax() { let state = Flip.getState(tt); def.appendChild(tt); float.classList.toggle("hide"); Flip.from(state, { fade: true, scale: true, ease: "power3.out", duration: 0.5 }); } function flipmin() { let state = Flip.getState(tt); float.appendChild(tt); float.classList.toggle("hide"); Flip.from(state, { fade: true, scale: true, ease: "power3.out", duration: 0.5 }); } I updated the codepen example from the previous thread you created about this to toggle the hide class from the floating element: function flip() { let state = Flip.getState(tt); float.classList.toggle("hide"); reparent ? parent.appendChild(tt) : float.appendChild(tt); tl = Flip.from(state, { scale: true, ease: "power3.out", duration: 0.5 }); reparent = !reparent; } https://codepen.io/GreenSock/pen/yLjKPEm Let us know if you have any other questions. Happy Tweening!
  8. Ahh yeah I see. In that case is better to create all the texts animations using a loop: let tl = gsap.timeline({/*...*/}); const texts = gsap.utils.toArray(".text-p"); texts.forEach((text, index) => { tl .from(text, { scale: 0, autoAlpha: 0, duration: 1, }) .to(text, { scale: 5, autoAlpha: 0, duration: 1, }, ">+=1") }); The reason for the video seems to be blocked is because the durations don't match. The total duration of all your text animations is far longer than the duration you set for the GSAP instance that controls the video's progress. GSAP is actually running that tween and is updating the video's progress, is just happening too fast! 🏎️ For that you can use the duration() method and function based values to set the duration of the video's progress instance to match the duration of the text animations: coolVideo.onloadedmetadata = function () { tl.to(coolVideo, { currentTime: coolVideo.duration, duration: () => tl.duration() }, 0); }; I updated the codepen example: https://codepen.io/GreenSock/pen/QWrmdxP Happy Tweening!
  9. Hi @Giedre Kavaliunaite and welcome to the GreenSock forums! I can see the jumping on Firefox but not in Chrome, on Ubuntu 20 and 22. Also I noticed you're using version 3.11.0 of GSAP and ScrollTrigger. A lot of stuff has been updated in the last month, so please try version 3.11.2 and see if that helps. https://cdnjs.com/libraries/gsap/3.11.2 Beyond that I can offer you too much help, since is quite difficult for us to debug a live website. Please provide a minimal demo that replicates just the issue you're having and we'll have a look at it. Happy Tweening!
  10. Hi @runejensencom, I'm struggling a bit to grasp exactly what you're trying to do. Perhaps this is what you're after? https://codepen.io/GreenSock/pen/dyemJGm If not please let us know. Happy Tweening!
  11. Hi, You weren't too far from it actually. All you were missing is check if the element was reparented or not and restore it to it's original parent element: https://codepen.io/GreenSock/pen/yLjKPEm Hopefully this is what you were looking for. Happy Tweening!
  12. Hi @Joenha and welcome to the GreenSock forums! There are a few small issues in your setup, but nothing that we can't solve, so let's get to it! First, there is no need for the two state properties menuOpen and toggle, since switching one should have he same effect in your React app, so just use one. Second, it's always a good idea to store GSAP instances that will be toggled back and forward in a ref, so they are kept through re-renders (more on that in a moment). Third, you are not passing any dependency to your useEffect hook, even though your entire component does just one thing, it's always a good idea, since a parent component could re-render and everything inside the useEffect will be executed again. Fourth, since version 3.11 GSAP has the Context method that helps specially with frameworks like react. The main problem is that you create a timeline on the first render, the click the button and toggle the timeline's direction, so far so good. The issue is that when you click the button again the state is updated and the timeline is created again and this time it's like nothing happens, but why? You're using a fromTo instance in a timeline that is immediately reversed, so when that instance is created again and it reversed state is set to true, it goes back, but it's already at 0 seconds, so it just stays there. GSAP is doing exactly what is supposed to. Here is where storing a GSAP instance that will be used over and over again in a ref comes in handy. The instance is created just once and then toggled when the state is updated, that's it. This code maybe works the way you expect: import React, { FC, useState, useEffect, useRef } from "react"; import { gsap } from "gsap"; const HamburgerMenu: FC = () => { const [toggle, setToggle] = useState<boolean>(false); const tl = useRef<GSAPTimeline>(gsap.timeline({ paused: true })); const hamburgerOverlay = useRef<HTMLDivElement | null>(null); const handleToggle = () => { setToggle(!toggle); }; useEffect(() => { gsap.set(hamburgerOverlay.current, { xPercent: 100, }); const ctx = gsap.context(() => { tl.current.to( hamburgerOverlay.current, { xPercent: 0, duration: 1 } ).reverse(); }); tl.current.reversed(!toggle); return () => ctx.revert(); }, [toggle]); return ( <div className="hamburger"> {!toggle ? ( <div onClick={handleToggle}> <div className="hamburger__toggle m-t-2 m-r-2"> <div className="hamburger__icon"></div> <div className="hamburger__icon"></div> </div> </div> ) : ( <div onClick={handleToggle}> <div className="hamburger__toggle m-t-2 m-r-2"> <div className="hamburger__icon"></div> <div className="hamburger__icon hamburger__icon--active"></div> </div> </div> )} <div className="hamburger__overlay" ref={hamburgerOverlay}> <div className="hamburger__nav"> <div className="hamburger__list"> <div className="hamburger__btn btn btn--primary">contact me</div> </div> </div> </div> </div> ); }; export default HamburgerMenu; Happy Tweening!
  13. Hi @amirTrujillo and welcome to the GreenSock forums! Well, this all depends on how you want to display this. If you want your animated elements to be visible and on top of the other three sections as they animate, then yeah what you have in place seems like a good way to do it, unless other user can think of a better way to achieve this. Just be careful with your real setup in terms of your CSS, since I'm assuming that your demo is quite simpler than the real life situation. Thanks by the way for the simple demo 👏 On the other hand if you want to not show the other three sections as your scroll animation is being played, then maybe a better setup with a position relative, or no position set, and a ScrollTtrigger pin could be the best way. Like I said, this depends on what you're trying to do. Finally thanks for being a Club member and supporting GreenSock! 🥳 Happy Tweening!
  14. Hi, The gallery example that you're using as inspiration, actually doesn't re-parents the image. It takes the position of the thumbnail adds some data such as image source and others to a container and then animates that container from the state of the selected thumbnail. If you reparent the thumbnail the whole grid would become a mess. If you want to do something like that check this mini tutorial by @Cassie and the live example: https://youtu.be/byyHoLPSxSQ https://codesandbox.io/s/flip-codesandbox-challenge-9c8vwc Finally I believe Lottie files are SVG paths, so there shouldn't be any pixelation whatsoever. If you inspect the DOM element where the Lottie animation is being played you can see only SVG and it should scale up and down without any issues, you just need to style the main SVG to fit the container it resides in. But I'm not an expert in SVG, perhaps Cassie (GSAP's resident SVG wizard) or @mvaneijgen can share more insight about it. Happy Tweening!
  15. Hi @Zenixbe and welcome to the GreenSock forums! The best approach I can think of is to have two ScrollTrigger instances, one for the images stripes (nice effect by the way, great job! 👏) and the text when the section top reaches a specific point in the viewport, and another one that only pins the container when it reaches the top of the viewport. In this case we can use a function based value for the end point and the end value of the ScrollTrigger instance to make both ScrollTrigger instances end at the same point. Also your text wrapper indeed has an absolute position inside of a relative parent BUT, it has no top or left position, so the browser puts it after the previous element. Hopefully this works in the way you expect: https://codepen.io/GreenSock/pen/yLjKMJO Let us know if you have other questions. Happy Tweening!
×