Jump to content
Search Community

Multiple parallax hovers

smallio test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi guys :)

 

Trying to make my own versions of commonly needed things with gsap as a little learning exercise. Today is parallax.

 

I'm super close on this one, but can't get it to work properly with multiple objects (& that's half the point of this exercise). After a few forks I'm still stuck, so I thought I'd see if someone can point me as to where I've gone wrong & also any pointers to structure/make it better.

 

I hope it's fairly easy to follow. It's 90% from scratch so I'm keen to hear how I'm doing & how to improve :)

 

Cheers!

 

 

 

See the Pen drNMWQ?editors=0011 by smallio (@smallio) on CodePen

Link to comment
Share on other sites

2 minutes ago, PointC said:

Is this what you need it to do?

 

See the Pen xBgXya by PointC (@PointC) on CodePen

 

 

Oh wow, I was way closer then I thought. Just needed to remove the ticker & use mousemove instead ehh. Thanks Mr. C :)

 

How do you think the structure of the code is? I'm at that stage where every day something clicks & it's super, super exciting, just still making a stupid mistake here and there that gets me stuck for hours. Can't wait to get past that.. if that's even a thing lol?

 

Cheers,

Smallio

Link to comment
Share on other sites

I'm certainly not a coding expert, but it looks good to me. My own philosophy of coding is:

  • Does everything work as expected?
  • Is the code as DRY as possible (or close to it)?
  • Did I use meaningful function and variable names?
  • Did I write myself enough comments that I can easily update this in 6 months?

If I can meet those criteria for my own code, I call it a good day. Just my two cents worth. ;)

 

  • Like 5
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...