CSS Parallax Tutorial! AWESOME Effect!

Sdílet
Vložit
  • čas přidán 18. 01. 2022
  • In this tutorial we'll be learning how to do a fancy parallax in pure CSS! This effect uses some transform3D effects as well as cursor location tracking in JavaScript to pull off this parallaxing effect.
    Parallax has been around for quite some time and is used quite often in video/commercial/web/apps and all over the place. It's a great technique to create a bit of depth and life to otherwise rigid interfaces!
    SUBSCRIBE TO DEVTUBE:
    / @devtube6000
    Photoshop Tutorials:
    • Cut Out Objects From B...
    • Animate a Still Photo ...
    💖 SUBSCRIBE (Please) 💖
    czcams.com/users/FollowAndrew?s...
    🚨 Cheap Professional Web Hosting 🚨
    studentwebhosting.com
    #css #html #webdev

Komentáře • 11

  • @mirjalol49
    @mirjalol49 Před rokem

    just awesome, pls keep uploading, i amlearning a lot

  • @tweedledumart4154
    @tweedledumart4154 Před 9 měsíci

    Great tutorial! Thank you!

  • @CrazyCodingChannel
    @CrazyCodingChannel Před 2 lety +2

    Cool tutorial, thnx for video man)

  • @moriahmwilson3003
    @moriahmwilson3003 Před 2 lety

    Wow - Dev Tube sounds cool!

  • @MacSaxe
    @MacSaxe Před 2 lety +1

    Fantastic project thank you - going to use this in a project tomorrow, super excited

  • @lovemadeinjapan
    @lovemadeinjapan Před 6 měsíci

    And one more: can you also make it work on a touch device?

  • @lovemadeinjapan
    @lovemadeinjapan Před 6 měsíci

    Follow up question. If I change the awkward variable name --x-translate to dX, it stops working. Is that a preset variable name? Can't find any info on where it comes from.
    Second question. If you move into the screen, the planes move to the new position instantly. Do you know how to ease the transitions?

  • @MrTiulia
    @MrTiulia Před rokem

    Nice tutorial, just have no idea why we add all this flexbox stuff to "face" and at the end make it absolute :D

  • @lovemadeinjapan
    @lovemadeinjapan Před 6 měsíci

    Nice tutorial, but I ran into a problem. Since you use Rotate 3D, the rectangles deform. So I was trying to use TranslateX/Y instead, but then the translation is the same for every layer. How to fix the translation to be relative?

    • @lovemadeinjapan
      @lovemadeinjapan Před 6 měsíci

      I fixed it by moving the translate with calc rules to the individual items and giving them different scaling factors. You have to include the basic scaling in the hover as well, otherwise it will go back to full size on hover.
      .one{
      background:url('image.png');
      background-size:cover;
      transform:
      translateZ(-8px)
      scale(0.25);
      }
      #wrap:hover .one{
      transform:
      translateZ(-8px)
      scale(0.25)
      translateX(calc(var(--x-translate,0)*0.5%))
      translateY(calc(var(--y-translate,0)*0.5%));
      }