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.


Auto Save

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="example"></div>
<div class="line"></div>


                .example {
  background-color: red;
  height: 100px;
  width: 100px;
  position: absolute;
  top: 10px;
  left: 10px;
  border-radius: 5px;
  display: flex;
  justify-content: flex-start;
  padding-left: 20px;
  align-items: center;

.line {
  top: 0;
  left: 210px;
  position: absolute;
  height: 120px;
  background-color: #fff;
  width: 1px;

.line:after {
  content: '200px';
  position: absolute;
  bottom: -25px;
  width: 100px;
  left: 50%;
  margin-left: -50px;
  text-align: center;


                const e = document.querySelector('.example');

const tl = gsap.timeline();

const tween1 =, { x: 200, duration: 2 });
tl.add(tween1, 0);

const tween2 =, { x: 0, duration: 2 });
tl.add(tween2, 2);

// The total duration of the timeline is 4 seconds.

tl.eventCallback("onUpdate", () => e.innerHTML = tl.totalTime())

// Shift the first to the right.
gsap.delayedCall(6, () => {
  // Let's make the first tween longer by 1 second.
  // To keep the total duration of the timeline (4 seconds) we need to adjust the second tween. Let's shift the startTime by 1 second and shrink the duration by 1 second.
  // A workaround by Carl.
  // UPDATED: just found out that it reproducible even withot .add()
  //tl.add(tween1, tween1.startTime());
    .then(() => {
      // Now .then and probably onComplete are delayed by 1 second.
      console.log(tl.totalTime()); // 5

// Let's go back...
gsap.delayedCall(12, () => {
  tl.add(tween1, tween1.startTime());
    .then(() => {
      console.log(tl.totalTime()); // 3, Wow!