Jump to content
Search Community

quickSetter pin or trigger?

EVA CORPORATION test
Moderator Tag

Recommended Posts

Good afternoon.

Please tell me, is there a function that will allow you to change styles or add a class to the ball block that follows the cursor.

For example, if the cursor hit a block with the btn class, dissolve the cursor by the size of the button block, or when hovering over blocks with the info-img and black-block class, the color changed (or added its own class to the ball). ^_^

See the Pen QWzmRgr by eglit_m (@eglit_m) on CodePen

Link to comment
Share on other sites

For the animation it self you can of course do what ever you want (for the filling of other elements I would look in to the Flip plugin). But you can just add event listeners to the elements you want things to happen and do your animation when that happens. Hope it helps and happy tweening! 

 

See the Pen eYbMwMz?editors=1011 by mvaneijgen (@mvaneijgen) on CodePen

Link to comment
Share on other sites

1 hour ago, mvaneijgen said:

For the animation it self you can of course do what ever you want (for the filling of other elements I would look in to the Flip plugin). But you can just add event listeners to the elements you want things to happen and do your animation when that happens. Hope it helps and happy tweening!

I didn't think it was possible to use add event listeners in this way!

Thank you very much ^___^

Link to comment
Share on other sites

1 hour ago, mvaneijgen said:

For the animation it self you can of course do what ever you want (for the filling of other elements I would look in to the Flip plugin). But you can just add event listeners to the elements you want things to happen and do your animation when that happens. Hope it helps and happy tweening!

And how to turn to the mix-blend-mode style? For example, there is a backgroundColor for the background.
Or is it easier to add a class when the cursor hits the black-block block?

Link to comment
Share on other sites

	document.querySelectorAll(".black-block").forEach((item) => {
	  item.addEventListener("mouseenter", function () {
	    gsap.to(".ball", {
		toggleClass: '.class-ball',
		backgroundColor: '#ffffff'
	    });
	  });
	  item.addEventListener("mouseleave", function () {
	    gsap.to(".ball", {
		backgroundColor: '#DE002B'
	    });
	  });
	});

For some reason, toggleClass is not added :(

Link to comment
Share on other sites

toggleClass is not a property of a tween (it is however a property of ScrollTrigger), but you don't really need GSAP to add a class to something, you could just do this with JS. 

 

Add mixBlendMode could also be set in a tween, keep in mind that it is not tween-able it will just switch between states.  

 

See the Pen NWeMWWE?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen

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