Pen Settings



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


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


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.


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.


                <div class="spacer"></div>
<div class="section">
  <div class="circle-wrap">
    <div class="circle"></div>
<div class="spacer"></div>


  position: relative;
  display: block;
  width: 100%;
  height: 100vh;
  background: black;

.spacer {
  display: block;
  width: 100%;
  height: 50vh;
  background: green;

.circle-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

.circle {
  display: block;
  width: 100px;
  height: 100px;
  background-color: red;



const proxy = { rot: 0 },
    rotSetter = gsap.quickSetter(".circle-wrap", "rotation", "deg"), // fast
    clamp = gsap.utils.clamp(-20, 20); // don't let the skew go beyond 20 degrees. 

  trigger: '.section',
  start: "top center",
  end: "bottom center",
  markers: {startColor: "white", endColor: "white"},
  onUpdate: (self) => {
    const rot = clamp(self.getVelocity() / -30);
    // only do something if the rotation is MORE severe. Remember, we're always tweening back to 0, so if the user slows their scrolling quickly, it's more natural to just let the tween handle that smoothly rather than jumping to the smaller rotation.
    if (Math.abs(rot) > Math.abs(proxy.rot)) {
      proxy.rot = rot;, {rot: 0, duration: 0.8, ease: "power3", overwrite: true, onUpdate: () => rotSetter(proxy.rot)});

const tl = gsap.timeline();

tl.set(".circle", {transformOrigin: "50% 50%"})
tl.fromTo(".circle", {rotation: 0}, {rotation: 360, duration: 10, repeat: -1, ease: "linear"})