<img class="smile" src="https://assets.codepen.io/756881/smiley.svg" />
<p>scroll down & change your reduced motion settings</p>
@import url("https://fonts.googleapis.com/css2?family=Nunito&display=swap");

body {
  min-height: 250vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Nunito", sans-serif;
}

.smile {
  width: 150px;
  height: 150px;
}

p {
  position: fixed;
  width: 100%;
  bottom: 1rem;
  text-align: center;
}
gsap.registerPlugin(ScrollTrigger);


/*** Different ScrollTrigger setups that respect motion preferences ***/
ScrollTrigger.matchMedia({
	
	// no motion preferences - go wild!
	"(prefers-reduced-motion: no-preference)": function() {
		// Any ScrollTriggers created inside these functions are segregated and get
		// reverted/killed when the media query doesn't match anymore. 
    let tl = gsap.timeline({
          scrollTrigger: {
          trigger: ".smile",
          scrub: 1,
          end: "200%",
          pin: true,
          start: 'center center',
          end: 'bottom 20%',
        }
      });
    tl.to(".smile", {scale: 2, rotation: 360})
      .to(".smile", {scale: 1});
  }, 
  
	//  option with less problematic motion for people with vestibular disorders and motion sensitivities   
	"(prefers-reduced-motion: reduce)": function() {
		// Any ScrollTriggers created inside these functions are segregated and get
		// reverted/killed when the media query doesn't match anymore. 
    let tl = gsap.timeline({ 
        scrollTrigger:{
          trigger: ".smile",
          scrub: 1,
          end: "200%",
          pin: true,
          start: 'center center',
          end: 'bottom 20%',
        }
      });
    tl.to(".smile", {opacity: 0.1})
      .to(".smile", {opacity: 1});
  },   
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js
  2. https://assets.codepen.io/16327/gsap-latest-beta.min.js
  3. https://assets.codepen.io/16327/ScrollTrigger.min.js?v=27