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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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="info">Drag the green circle</div>
<svg id="svg" viewBox="0 0 1000 1000" preserveAspectRatio="xMidYMid meet">   
  <path id="follower" class="follower ball" d="M713,543.5A55.5,55.5,0,1,1,768.5,488,55.5632,55.5632,0,0,1,713,543.5Z"/>
  <path id="dragger" class="dragger ball" d="M301.5,362.5a55,55,0,1,1,55-55A55.06223,55.06223,0,0,1,301.5,362.5Z"/>


                #svg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;  

.info {
  position: fixed;
  top: 0;
  left: 0;
  padding: 12px;
  font-size: 18px;
  color: #333;
  pointer-events: none;
  user-select: none;
  z-index: 1;

.dragger {
  fill: #2edb1b;
  stroke: #2edb1b;
  stroke-width: 4;  
  fill-opacity: 0.4;

.follower {
  fill: #d81dc6;
  stroke: rgba(0,0,0,0.2);
  stroke-width: 2;
  pointer-events: none;




const dragger = document.querySelector("#dragger");
const follower = document.querySelector("#follower");

TweenLite.set(follower, {
  transformOrigin: "center",
  scale: 0.8

const draggable = new Draggable(dragger, {
  throwProps: true,
  bounds: window,

TweenLite.ticker.addEventListener("tick", updateFollower);
window.addEventListener("resize", () => draggable.update(true));

function updateFollower() {
  const box1 = getBBox(follower);
  const box2 = getBBox(dragger);
  const dx = -;
  const dy = -;
  TweenLite.set(follower, {
    x: `+=${dx * 0.1}`,
    y: `+=${dy * 0.1}`,

 * @param {SVGElement} element - Element to get the bounding box for
 * @param {boolean} [withoutTransforms=false] - If true, transforms will not be calculated
 * @param {SVGElement} [toElement] - Element to calculate bounding box relative to
 * @returns {SVGRect} Coordinates and dimensions of the real bounding box
function getBBox(element, withoutTransforms, toElement) {
  var svg = element.ownerSVGElement;
  if (!svg) {
    return { x: 0, y: 0, width: 0, height: 0 };
  if (withoutTransforms) {
    return element.getBBox();
  var p = svg.createSVGPoint();
  var r = element.getBBox();     
  var matrix = (toElement || svg).getScreenCTM().inverse().multiply(element.getScreenCTM()); 

  p.x = r.x;
  p.y = r.y;
  var a = p.matrixTransform(matrix);

  p.x = r.x + r.width;
  p.y = r.y;
  var b = p.matrixTransform(matrix);

  p.x = r.x + r.width;
  p.y = r.y + r.height;
  var c = p.matrixTransform(matrix);

  p.x = r.x;
  p.y = r.y + r.height;
  var d = p.matrixTransform(matrix);

  var minX = Math.min(a.x, b.x, c.x, d.x);
  var maxX = Math.max(a.x, b.x, c.x, d.x);
  var minY = Math.min(a.y, b.y, c.y, d.y);
  var maxY = Math.max(a.y, b.y, c.y, d.y);
  var width = maxX - minX;
  var height = maxY - minY;
  return {
    x: minX,
    y: minY,
    width: width,
    height: height,        
    cx: minX + width / 2,
    cy: minY + height / 2