Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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="wrapper">
<img src="" style="transform: scaleX(-1); width: 200px" id="rec"/>
<svg fill="none" xmlns="" width="100%" viewBox="0 0 1000 1000">
  <path id="path" d="M0 100s269.931 86.612 520 0c250.069-86.612 480 0 480 0" stroke="black" stroke-width="1"/>


                body {
    width: 100%;
    height: 3000px;
    overflow-x: hidden;
.wrapper {
  width: 100vw;
  height: 100vh;
  overflow: hidden;

#rec {
    position: absolute;
    background-color: white;



// The start and end positions in terms of the page scroll
// const offsetFromTop = innerHeight * 0.25;
// const pathBB = document.querySelector("#path").getBoundingClientRect();
// const startY = - innerHeight + offsetFromTop;
// const finishDistance = startY + pathBB.height - offsetFromTop;

// the animation to use
let tl = gsap.timeline({
  scrollTrigger: {
    trigger: ".wrapper",
      pin: true, 
      markers: true, // pin the trigger element while active
      start: "top top", // when the top of the trigger hits the top of the viewport
      scrub: 1,
})"#rec", {
  duration: 5, 
  ease: "none",
  motionPath: {
    path: "#path",
    align: "#path",
    autoRotate: false,
    alignOrigin: [0.5, 0.5]

// Listen to the scroll event
// document.addEventListener("scroll", function() {
//   // Prevent the update from happening too often (throttle the scroll event)
//   if (!requestId) {
//     requestId = requestAnimationFrame(update);
//   }
// });

// update();

// function update() {
//   // Update our animation
//   tween.progress((scrollY - startY) / finishDistance);
//   // Let the scroll event fire again
//   requestId = null;
// }