Jump to content
Search Community

menu like macOS dock help

berikiushi 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

I would like to make the menu with the smooth magnification effect like the dock in macOS.

 

I took this example as a basis 

See the Pen BZNGyd by osublake (@osublake) on CodePen

 but the animation does not work smoothly and only starts when you move to the next or previous element.

 

Is it possible to make the animation work smoothly and work at the slightest mouse movement? As in this example 

See the Pen bNZrEN by icebob (@icebob) on CodePen

 

Any help with this question would be great.

 

See the Pen zmybJa by berikiushi (@berikiushi) on CodePen

Link to comment
Share on other sites

  • 4 years later...
10 hours ago, thomasJack said:

this is awesome, any did any one figure out how to make the toolbar bkg expand with it? 

I'm not entirely sure what you mean or the visual effect you want, but why don't you give it a try and then if you get stuck, post your minimal demo here (like a CodePen) and we'll do our best to answer any GSAP-specific questions?

Link to comment
Share on other sites

  • 4 months later...
On 3/25/2023 at 7:38 PM, GreenSock said:

I'm not entirely sure what you mean or the visual effect you want, but why don't you give it a try and then if you get stuck, post your minimal demo here (like a CodePen) and we'll do our best to answer any GSAP-specific questions?

I think I'm trying to achieve this same effect. I kinda got it working by modifying the code @OSUblake provided in his answer to the original question. But there is a problem I can't figure out how to fix. See as you hover over the icons the width changes correctly, but while the icons seem to scale correctly on the left side of the toolbar they scale incorrectly on the right side, im guessing because of the width of the toolbar changing and certain vallues not getting updated. 

 

This is me hovering on the left side of the toolbar which seems to work correctly:

image.jpeg.c3475c98cb1db71193ed03e5e3b4b8a7.jpeg

And this is me hovering on the right side of the toolbar where you can see the icons to the right side of the mouse scale too early and are too large because of this:

image.jpeg.bf7f88bdd0412be6b4d031a79c5fccd4.jpeg

Any help is greatly appreciated

See the Pen QWJZerM by jo_orin (@jo_orin) on CodePen

Link to comment
Share on other sites

Hi @jorin and welcome to the GreenSock forums!

 

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 Stackblitz 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/Vue/Nuxt or some other framework, you may find StackBlitz easier to use. We have a series of collections with different templates for you to get started on these different frameworks: React/Next/Vue/Nuxt.

 

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

1 minute ago, GSAP Helper said:

Hi @jorin and welcome to the GreenSock forums!

 

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 Stackblitz 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

 

 

If you're using something like React/Next/Vue/Nuxt or some other framework, you may find StackBlitz easier to use. We have a series of collections with different templates for you to get started on these different frameworks: React/Next/Vue/Nuxt.

 

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

I included a demo, any help would be appreciated!

Link to comment
Share on other sites

Hi,

 

This is not the simplest thing to solve since the width of the bounds is being updated constantly, you can see the gray bar growing/contracting as you move the mouse left-to-right, so that could be the cause for this behaviour.

 

Unfortunately we don't have the time resources to solve complex issues that are not 100% GSAP related (in fact GSAP is doing exactly what is supposed to) for our users. You could try experimenting with a fix width of the container on mouse enter first and see how that works. As you can see in Blake's example using a fixed width in the container doesn't create the issue.

 

Good luck with your project.

Happy Tweening!

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...