How to Make Page Transitions using Next.js and GSAP

Поділитися
Вставка
  • Опубліковано 5 жов 2024

КОМЕНТАРІ • 88

  • @olivierlarose1
    @olivierlarose1  6 місяців тому +12

    When using GSAP in production, you might have FOUC (flash of unstyled content) , you can avoid that by adding an initial CSS value like opacity: 0. You can read more here: gsap.com/resources/fouc/

  • @elcho007
    @elcho007 6 місяців тому +11

    Simply no words for the quality of your content, hats off to you. You are a true gem!! Thank you.

  • @flavioczuk
    @flavioczuk 26 днів тому

    Brooooo you´re a legend!!!
    I´ve stumbled upon the link you´ve mentioned on the video by John Polacek but I was having a hard time understanding everything...
    With your explanation everything is now crystal clear and I was able to update my project and implement everything that way I had planned!
    Thank you very much and keep up the awesome work!!!!

  • @TheRealG-yt9yj
    @TheRealG-yt9yj 6 місяців тому +1

    SIR THANK YOU VERY MUCH . as a beginner we have so many doubts and stuff . The way your content helps is just NEXT LEVEL . THANK YOU . 😊😊

  • @alvarobyrne
    @alvarobyrne 6 місяців тому +1

    I am a beginner, just took part of one react (native) project and (as you may see for what I am about to say never did nextjs work) it surprises me that nextjs doesn't provide (never better said) a global context! Very well done! Note for self: `Component` (arg of `App`) has a `key` prop

  • @wailokwang
    @wailokwang 6 місяців тому +3

    Olivier, thanks for your vids. I just wanted to mention that the Next.js team doesn't seem to care about page transitions on app routes, even though it's been released since Next.js 13 (and since you started uploading videos). Lol.

  • @lThePotatoCrew
    @lThePotatoCrew 6 місяців тому +2

    If only this worked with app router :(. Great work though, your explain everything very well!

  • @zjebinsky
    @zjebinsky 6 місяців тому +1

    Just discovered your channel. This is golden!!

  • @BharatBhandari-s5i
    @BharatBhandari-s5i 5 місяців тому +1

    Awesome explanation, can you please also suggest a way to add Intro animation in nextjs Page Router

  • @edojoshua
    @edojoshua 6 місяців тому

    Great work as always Oli!

  • @MrJfergs
    @MrJfergs 6 місяців тому +1

    I think you are one of the best Creative UI devs on UA-cam if not the entire internet. Thank you for your content, I wanted to ask if you are from France? It seems that many of the devs within this niche are from France or Quebec. Merci beaucoup pour votre travail. I wanted to ask if this transition will be using the Pages or App router in next.js?

    • @olivierlarose1
      @olivierlarose1  6 місяців тому

      I’m from Montreal, Quebec yes and this page transition is with the page router only

    • @MrJfergs
      @MrJfergs 6 місяців тому

      @@olivierlarose1 Nice, I ma actually not too far from Montreal myself. I have yet to find a good solution for page transitions using the app router yet.

  • @TheBorninmotion
    @TheBorninmotion 6 місяців тому

    wow amazing example ! Please make more tuts using nextjs page router and gsap, keep up !

  • @devwithzain
    @devwithzain 6 місяців тому +5

    Preloader animation olivier please 🙏

    • @olivierlarose1
      @olivierlarose1  6 місяців тому

      Noted!

    • @thisissahaj
      @thisissahaj 6 місяців тому

      You can find a small bit of it in the 2nd video of his playlist..Vid - "Rebuilt Awwwards Website..."

  • @mateuspaula_dev
    @mateuspaula_dev 5 місяців тому

    Thanks for this content buddy, all the best for you always!!

  • @funstationatlanta
    @funstationatlanta 4 місяці тому

    This is amazing! great work.

  • @seanzhang3873
    @seanzhang3873 4 місяці тому +1

    This is great, but can you make a tutorial on Framer Motion with Next.js 13+, using the new app router. I am struggle to create transition out animation and cannot find much resource on this.

  • @dewann99
    @dewann99 6 місяців тому +4

    If the "sleeper build" was a channel.

  • @anythingfx8950
    @anythingfx8950 6 місяців тому

    Your content is always top-notch! Thank you. Could you elaborate on why that approach is not supported on the app router, please?

  • @olawanletemitayo2174
    @olawanletemitayo2174 6 місяців тому

    Goated video as always ✨🎉

  • @nellymotion
    @nellymotion 6 місяців тому

    so much good information, thank you

  • @brittonwalker7341
    @brittonwalker7341 6 днів тому

    How would you approach this if you wanted the entry animation to animate in before the old content exits? For example, have the new content swipe up over the old content and then handle the removal of the old content?

  • @AntTheOne777
    @AntTheOne777 5 місяців тому

    Hey! When will your online courses be accessible? Amazing work btw.

  • @shivkumar6374
    @shivkumar6374 6 місяців тому

    Loved to see your videos

  • @rohitpandey4411
    @rohitpandey4411 5 місяців тому

    your video is awesome, and your name is weird olivier. Thanks its a very simple implementation with good instincts

  • @MARSTEE-official
    @MARSTEE-official 6 місяців тому +1

    Nice video. It’s possible in App Router with templates. (Layouts x templates).

    • @PaperKrane
      @PaperKrane 6 місяців тому

      I wanted to say that too. Kind of confused as to why he claims it's 'hacky' by using onClick={} on top of a Next Link component.

    • @Ss-zg3yj
      @Ss-zg3yj 6 місяців тому

      Not possible

  • @electroheadfx
    @electroheadfx 6 місяців тому

    amazing man, thanks for the tip

  • @marcelsdev
    @marcelsdev 5 місяців тому

    Ever thought of using or replacing GSAP with Framer Motion? Only reason I don't use GSAP for products is because some library features are priced and I can replicate them using Framer Motion. Your thoughts?

    • @marcelsdev
      @marcelsdev 5 місяців тому

      Nevermind... I see you use Framer Motion on other projects 😄 Great content! 🦾

  • @stoggys
    @stoggys 5 місяців тому

    Great stuff!

  • @xberna8156
    @xberna8156 6 місяців тому

    Amazing!

  • @fokspoks
    @fokspoks Місяць тому

    but how nextjs doesn't ask you to add 'use client' in places where you use hooks?

  • @jjuuiiccyyjj
    @jjuuiiccyyjj 6 місяців тому

    thanks for this!

  • @ninjagaskin
    @ninjagaskin 4 місяці тому

    Any idea when this would be useful for app router next js?

  • @dmnkb
    @dmnkb 6 місяців тому

    For a real live project using Next.js would you rather recommend Framer Motion or GSAP?

    • @olivierlarose1
      @olivierlarose1  6 місяців тому +1

      Either is fine, but personally I would use Framer Motion

  • @2hari-g2b
    @2hari-g2b 6 місяців тому

    Man wat camera do you use ? your videos are really sharp !

  • @liamrahimian1588
    @liamrahimian1588 2 місяці тому

    Add a route outside your header and the route will stop working because of the transition component.

  • @thomasfichtner9738
    @thomasfichtner9738 2 місяці тому

    Hey is there a way to make the animation mode sync. like play exit and enter animation simultaneously

  • @CodeCraftersStudio
    @CodeCraftersStudio 5 місяців тому

    Plesse update this with app router
    Thankyou in advance

  • @alexnjagi3169
    @alexnjagi3169 5 місяців тому

    🤔I wouldn't recommend saving children components to the state, it might raise performance concerns for large component trees.
    Instead of using the state to listen for children changing, can't we just use `Router. events` from next js, and anytime we move to another page, we can perform some action.

    • @olivierlarose1
      @olivierlarose1  5 місяців тому

      I agree with you, but a problem I see with using router events is we wouldn’t have control over the displaying of the pages, so I don’t see how we could delay the page transition to leave space for the exit animation

  • @eduardaskuliesa8308
    @eduardaskuliesa8308 6 місяців тому

    I have created page transitions with custom Links, and they have entry and exit animations. Everything works fine, but I don't get it why this is wrong ?

  • @spacemanXVI.
    @spacemanXVI. 3 місяці тому

    🔥🔥🔥🔥

  • @quebuena111
    @quebuena111 3 місяці тому

    And why the page router, that’s old stuff

  • @electroheadfx
    @electroheadfx 6 місяців тому

    did you already apply for Next with app version ?

  • @monarchgam3r
    @monarchgam3r 6 місяців тому

    This solution is kinda old and only works with pages router, unless it’s an old or already existing project, app is just better to use and recommended, unfortunately there doesn’t seem to be a way to do page transitions with app router

    • @olivierlarose1
      @olivierlarose1  6 місяців тому

      Page router gets a lot of hate for nothing haha, it still works fine for presentation type websites

    • @Ss-zg3yj
      @Ss-zg3yj 6 місяців тому

      @@olivierlarose1 you know there's people building something else but useless awwards shitty agency websites no one using, right?

  • @joostschuur
    @joostschuur 6 місяців тому

    When it comes to page animations, does GSAP have any advantages over Framer Motion or vice versa?

    • @olivierlarose1
      @olivierlarose1  6 місяців тому

      No the final result is quite similar. I would say Framer Motion has a faster and cleaner implementation and in my experience GSAP has some FOC problems that you need to manage.

  • @puturangga2024
    @puturangga2024 5 місяців тому

    Can you make it again but using motion framer?

  • @fiha_khair_yt
    @fiha_khair_yt 6 місяців тому

    I'm still waiting for web course😅❤

    • @olivierlarose1
      @olivierlarose1  6 місяців тому +1

      Coming soon! Working on new modules including shaders and complex animations

    • @fiha_khair_yt
      @fiha_khair_yt 6 місяців тому

      @@olivierlarose1 Thank you ❤

  • @KaluKarKK
    @KaluKarKK 6 місяців тому

    Am I mistaken, or you can use template on the app router for page transition!! 🙁

    • @devwithzain
      @devwithzain 6 місяців тому

      Yes ua-cam.com/video/VnRC8PyzBT8/v-deo.htmlsi=fNV-NVm7_0pNIuRR

    • @olivierlarose1
      @olivierlarose1  6 місяців тому

      I saw this video, and like I said in the beginning of the video, I am not comfortable using this approach for a client, as it overrides the Link component with a button and an on click event, which is not good for SEO and accessibility.

  • @bhuvya11
    @bhuvya11 6 місяців тому

    Chad video 💯💯

  • @DuBritoo
    @DuBritoo 6 місяців тому

    what’s your webcam?

  • @roguegoblin2407
    @roguegoblin2407 6 місяців тому

    hey oli! sent you a discord dm with a way to these transitions in nextjs with app router :)

    • @olivierlarose1
      @olivierlarose1  6 місяців тому +1

      Hey man, thanks for the ressource. Unfortunately, you’re doing it in one of the two ways I described in the beginning of the video (page transition with an on click on a button), which is not good for SEO and accessibility. I personally would not feel comfortable using that in production for a client. As of now, if I want a page transition, I use the Page router, which still works fine for presentation websites. Cheers

    • @roguegoblin2407
      @roguegoblin2407 6 місяців тому

      @@olivierlarose1 ohh didnt realize that was what you meant, I thought you meant a literal button, sorry!

  • @jheanbrizadao2429
    @jheanbrizadao2429 6 місяців тому

  • @ayoubdev8019
    @ayoubdev8019 6 місяців тому

    First viewer first comment , nice video oliv

  • @Ss-zg3yj
    @Ss-zg3yj 6 місяців тому +14

    Pages router...USELESS!

    • @jason.zubiate
      @jason.zubiate 3 місяці тому

      you can do this with a template.tsx file. check next docs. basically what he's making

    • @Ss-zg3yj
      @Ss-zg3yj 3 місяці тому

      @@jason.zubiate there's no exit transition in App Router, you 🤡

  • @StephenRayner
    @StephenRayner 6 місяців тому

    Meh page router…

    • @PaperKrane
      @PaperKrane 6 місяців тому

      You can do page transitions with app router as well using templates.

    • @olivierlarose1
      @olivierlarose1  6 місяців тому

      Send me a link! Would be surprised if it does not fall in either one of the two categories I mentioned in the intro

    • @Ss-zg3yj
      @Ss-zg3yj 6 місяців тому

      @@PaperKrane no you can't

    • @PaperKrane
      @PaperKrane 6 місяців тому

      ​@@Ss-zg3yj Lol I wrote an entire message on this chain of how you *can* but it looks like the channel creator deleted it because it disproves his point. Research Next.js 'templates' that are rendered inside of layout.js. You can create an animation in and build your own Next.js Link component that just ads an animation on the outro and then uses Next.js router to push the next page. I have apps in production with this but hey, if you want to live in a bubble and believe it isn't possible, that is A-OK with me.

    • @Ss-zg3yj
      @Ss-zg3yj 6 місяців тому

      @@PaperKrane templates has BROKEN exit transitions. what are you talking about? you have problems with your vision?

  • @dickson710
    @dickson710 6 місяців тому

    Always inspiring!! Keep it up bro