Jump to content
Search Community

Caspert

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by Caspert

  1. Hi,

     

    I just saw the infinite slider of  GSAP, but I want to add another functionality, so when the user scrolls, the slides are snapping in view.

    I added the ScrollTrigger functionality, but it seems it not working and I can't find the issue by myself.

     

    So does anyone know how I can fix the issue, so the slider can also used with scroll, similar to how the prev and next buttons work?

     

    // Use ScrollTrigger to control the slider with scroll
    gsap.to(wrapper, {
      scrollTrigger: {
        trigger: wrapper,
        start: "top top",
        end: "bottom bottom",
        scrub: 1, // Controls the sensitivity of the scroll
      },
      onUpdate: (scrollTrigger) => {
        const progress = scrollTrigger.progress;
        const totalDuration = loop.totalDuration();
        const time = progress * totalDuration;
        loop.tweenTo(time);
      },
    });

     

    See the Pen bGZvKMW by Caspert (@Caspert) on CodePen

  2. Hi,

     

    I am trying to create an infinite horizontal carousel, but the infinite part is not working. 

    The three slides are cloned one time and after the 6 slide it stops.

     

    So what I am trying to create is the following. A horizontal carousel slider where the items are full width. 

    When scrolling down or up, the slider moves to the left or right and snaps into place. The missing part is the infinite slider, where it will scroll infinite, if this can be an optional thing to add, it would be nice.

     

    Here you can find my Codepen. If someone have a better solution or example, please let me know. It will help me a lot.

     

    Casper

     

     

    See the Pen jOJzKby by Caspert (@Caspert) on CodePen

  3. Hi all,

     

    I am trying to create a scale animation on click and holding that click. What I would like to achieve is when clicking on an element and holding that click, the image inside will be animation the scale property till it's 2.0. By releasing the click, it will animate back to default scale (1.0).

     

    I came with the following code, but doesn't know what the next step is to get the effect I mentioned before.

     

    var image = $('img');
    
    		$('li').click(function() {
    			TweenMax.to(image, .6, {
    				scale: 1.05,
    				ease: "smoothInOut",
    				onComplete: function() {
    					
    					TweenMax.to(image, .4, {
    						scale: 1,
    						ease: "smoothInOut"
    					});
    				}
    			});
    		});

     

    It's inspired by the following site at the 5th section (the slider).

     

    Hope someone can help me a little bit :)

×
×
  • Create New...