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.


<p>Drag the box below. When released, the green dot will animate to the top left corner using getGlobalMatrix() to calculate the position even though it's scaled and rotated. Feel free to change the transforms or nest the #dragme element as deeply as you want inside transformed containers.</p><br>
<div id="dragme">Drag me</div>
<div id="dot"></div>

<a href=""><img class="gsap-3-logo" src="" width="150" /></a>


                body {
  padding: 10px 15px;
  text-align: center;

p {
  font-weight: 300;
  max-width: 900px;
  display: inline-block;
  text-align: left;

#dot {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  background-color: #88ce02;

#dragme {
  width: 200px;
  height: 140px;
  background-color: #555;
  color: white;
  text-align: center;
  line-height: 140px;
  font-size: 38px;
  display: inline-block;
  border: 2px solid #ccc;

.gsap-3-logo {
    width: 20vw;
    max-width: 150px;
    position: fixed;
    bottom: 15px;
    right: 15px;


                gsap.registerPlugin(Draggable, MotionPathPlugin);

let dragme = document.querySelector("#dragme");

// apply some transforms to make it more impressive, {scale: 0.7, rotation: -20, y: 10, duration: 1.5});

// make it draggable
Draggable.create(dragme, {onRelease: moveDot, bounds: window});

// here is where the magic is...
function moveDot() {
    let matrix = MotionPathPlugin.getGlobalMatrix(dragme),
        // 0,0 is the top left corner, but try any local coordinates like {x: 200, y: 140} for the bottom right corner.
        localPoint = {x: 0, y: 0}, 
        // the matrix has an apply() method that applies the matrix transformations on a point, returning a new (translated) one.
        globalPoint = matrix.apply(localPoint);"#dot", {
      x: globalPoint.x,
      y: globalPoint.y,
      ease: "power1.inOut"