Jump to content
Search Community

Follow Mouse

Dinho test
Moderator Tag

Recommended Posts

Hi there Dinho,

We try to keep the forums to specific GSAP questions - From our forum guidelines
 

On 12/7/2020 at 10:19 PM, GreenSock said:

What topics should be avoided?

As much as we love solving problems, the following types of questions are beyond the scope of what we generally provide here for free:

  • “How do I do this cool effect I saw on a trendy website?” Someone here may point you in the right direction but please don't expect a full tutorial on how to create an effect you saw on a slick web site.


Here's a codepen as a starting point.

Good luck!

See the Pen WNNNBpo by GreenSock (@GreenSock) on CodePen

  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...

Thank you very much Cassie, I will follow the guidline forum in the future, sorry.

  • First, how do I make the ball deform when moving the mouse ?
  • Second, how do I make the border of the red section bounce when the cursor enters above it ?

Here's a codepen that I adjusted :

See the Pen zYdqaQG by DinhoDev (@DinhoDev) on CodePen

Thank you in advance for your answer. 👍

 

Link to comment
Share on other sites

Hey Dinho,

We're happy to answer GSAP-specific questions, but these are both complex interactions involving a lot of JS logic. I'm afraid we don't have the resources to sculpt custom solutions.

Maybe this thread will help with the 'deforming' side of things though? It's a react solution, but the logic will be the same - get the velocity of the mouse and then skew the element with GSAP.

See the Pen bGRvvOe by blitzve0 (@blitzve0) on CodePen

 

 



For the 'bounce' you'd need to look into shape morphing, but again, this is complex. You'll need to track where the mouse is and morph path points depending on where the mouse enters.

Maybe this article will help.

https://georgefrancis.dev/writing/create-a-liquid-hover-effect-with-gsap-and-svg/

  • Like 2
Link to comment
Share on other sites

  • 7 months later...

hi. guys. I tried out your examples. It worked, but one issue: this can't affect elements with z-index. I mean if I hover a  button which has z-index: 999; mouse lays down this button as it has zero z-index. And when  I set its z-index to 1000 (+1 from the button!), I cannot click the button for some reason.

 

And also, can I change this mouse's style while hovering some elements?

Link to comment
Share on other sites

Hi @Mukhriddin. It's pretty tough to troubleshoot without a minimal demo - the issue could be caused by CSS, markup, a third party library, your browser, an external script that's totally unrelated to GSAP, etc. Would you please provide a very simple CodePen or CodeSandbox that demonstrates the issue? 

 

Please don't include your whole project. Just some colored <div> elements and the GSAP code is best (avoid frameworks if possible). See if you can recreate the issue with as few dependancies as possible. If not, incrementally add code bit by bit until it breaks. Usually people solve their own issues during this process! If not, then at least we have a reduced test case which greatly increases your chances of getting a relevant answer.

 

Here's a starter CodePen that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

See the Pen aYYOdN by GreenSock (@GreenSock) on CodePen

 

If you're using something like React/Next/Nuxt/Gatsby or some other framework, you may find CodeSandbox easier to use. 

 

Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. 

Link to comment
Share on other sites

Hi, sure. Please, see codepen here.

See the Pen mdXXBjL by Mukher (@Mukher) on CodePen

Now, cursor is workking allright regarding UI. But when you try to click, hamburger to see menus, it doesn't click as the cursor has z-index: 100;

So you can say, remove z-index then. But no, if I remove it, it lays down the white layout, and doesn't seem what  expect(with mix-blend-mode: difference;)

 

And also, I wanted to know is it possible to change style(scale: 1.5; for example), when I hover logo, hamburger, or anything I want.

Thanks for the quick reply!

P.s: please, don't pay attention to styles, I just copied in a hurry :)

 

 

Link to comment
Share on other sites

1 hour ago, Mukhriddin said:

But when you try to click, hamburger to see menus, it doesn't click as the cursor has z-index: 100;

Oh, then just set pointer-events: none (css) on your cursor so that the browser ignores it in terms of events. 

 

2 hours ago, Mukhriddin said:

And also, I wanted to know is it possible to change style(scale: 1.5; for example), when I hover logo, hamburger, or anything I want.

 

Sure. 

See the Pen zYRRPga?editors=0010 by GreenSock (@GreenSock) on CodePen

 

I hope that helps.

  • Like 3
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...