Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
<div class="container gsap">
  <div class="wheel">
    <p class="txt">word nr 1</p>
    <p class="txt">word nr 2</p>
    <p class="txt">word nr 3</p>
    <p class="txt">word nr 4</p>
    <p class="txt">word nr 5</p>
    <p class="txt">word nr 6</p>
    <p class="txt">word nr 7</p>
    <p class="txt">word nr 8</p>
    <p class="txt">word nr 9</p>
    <p class="txt">word nr 10</p>
    <p class="txt">word nr 11</p>
    <p class="txt">word nr 12</p>
    <p class="txt">word nr 13</p>
    <p class="txt">word nr 14</p>
    <p class="txt">word nr 15</p>
    <p class="txt">word nr 16</p>
    <p class="txt">word nr 17</p>
    <p class="txt">word nr 18</p>
    <p class="txt">word nr 19</p>
    <p class="txt">word nr 20</p>
    <p class="txt">word nr 21</p>
    <p class="txt">word nr 22</p>
    <p class="txt">word nr 23</p>
    <p class="txt">word nr 24</p>
    <p class="txt">word nr 25</p>
    <p class="txt">word nr 26</p>
    <p class="txt">word nr 27</p>
    <p class="txt">word nr 28</p>
    <p class="txt">word nr 29</p>
    <p class="txt">word nr 30</p>
    <p class="txt">word nr 31</p>
    <p class="txt">word nr 32</p>
    <p class="txt">word nr 33</p>
  </div>
</div>
    
              
            
!

CSS

              
                
  html {
    box-sizing: border-box;
  }
  
  *,
  *:before,
  *:after {
    box-sizing: inherit;
  }
  
  body,
  html {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
  }
  
  body {
    background: #fff;
    font-family: Helvetica;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0px;
    height: 100%;
    -webkit-perspective: 1000px;
            perspective: 1000px;
  }
  
  .wheel {
    position: relative;
    width: 100vw;
    height: 60vh;
    -webkit-transform-style: preserve-3d;
            transform-style: preserve-3d;
    -webkit-transform-origin: 50% 50%;
            transform-origin: 50% 50%;
    border: 10px solid green;
  }
  
  .txt {
    position: absolute;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
            transform: translate(-50%, -50%);
    margin: 0;
    font-size: 3vw;
    font-weight: 900;
    text-transform: uppercase;
    -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
    -webkit-transform-style: preserve-3d;
            transform-style: preserve-3d;
  }
  
  
  
  .red{
    color: red;
  }
              
            
!

JS

              
                
let wheel = document.querySelector(".gsap .wheel"),
  numLines = 33,
  radius = numLines * 17,
  angle = 360 / numLines,
  origin = `50% 50% -${radius}px`;


gsap.set(wheel, { transformOrigin: "50% 50%" });
gsap.set(wheel.querySelectorAll(".txt"), {
  z: radius,
  rotationX: (index) => angle * index,
  transformOrigin: origin
});

gsap.registerPlugin(ScrollTrigger);

let count = 0
gsap.to(wheel, {
  rotationX: -360,
  ease: "none",
  transformOrigin: "50% 50%",
  scrollTrigger: {
    trigger: '.container',
    start: "center center",
    end: "+=20000px",
    markers: true,
    scrub: .5,
    pin: true,
    snap: {
	   snapTo: 1 / 33,
	   duration: 0.5,
     onComplete: (scrollTrigger )=> {
       console.log(scrollTrigger.progress)
     }
	 },
  }
});

              
            
!
999px

Console