Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <div id="container">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000" width="1000" height="1000">
  <circle id="base-path" r="450" cx="500" cy="500" />
  <circle id="motion-path" r="450" cx="500" cy="500" />

  <g id="targets">
    <g>
      <circle></circle><text>1</text>
    </g>
    <g>
      <circle></circle><text>2</text>
    </g>
    <g>
      <circle></circle><text>3</text>
    </g>
    <g>
      <circle></circle><text>4</text>
    </g>
    <g>
      <circle></circle><text>5</text>
    </g>
    <g>
      <circle></circle><text>6</text>
    </g>
    <g>
      <circle></circle><text>7</text>
    </g>
    <g>
      <circle></circle><text>8</text>
    </g>

  </g>

</svg>
  
  </div>
              
            
!

CSS

              
                body {
  padding: 0;
  margin: 0;
  font-family: Inter, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif;
  background: #262626;
}

#container {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

svg {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
}

#base-path {
  fill: none;
  stroke: gray;
  stroke-width: 2px;
}
#motion-path {
  fill: none;
  stroke: #42a6e0;
  stroke-width: 6px;
}

#targets circle {

  cx: 500;
  cy: 50;
  stroke-width: 2px;
}

text {
  text-anchor: middle;
  font-size: 36px;
  transform: translate(500px, 50px);
  dominant-baseline: middle;
}

              
            
!

JS

              
                gsap.registerPlugin(DrawSVGPlugin);
gsap.config({ trialWarn: false });
console.clear();
const background = "#262626";
const highlight = "#42a6e0";
const targets = gsap.utils.toArray("#targets g");
const circles = gsap.utils.toArray("#targets circle");
const text = gsap.utils.toArray("#targets g text");

gsap.set(circles, { r: 20, fill: background, stroke: highlight });
gsap.set("#motion-path", { rotation: -90, svgOrigin: "500 500", drawSVG: 0 });

let pathSegment = DrawSVGPlugin.getLength("#motion-path") / 8;
let drawLength = 0;

const tl = gsap.timeline({delay:2});

// rotate circles around the motion path
gsap.set(targets, {
  svgOrigin: "500 500",
  rotation: (i) => {
    return i * 45;
  }
});
//rotate the text the opposite direction so it's facing the right way
// and set opacity to 0
gsap.set(text, {
  svgOrigin: "500 50",
  fill: "background",
  opacity: 0,
  rotation: (i) => {
    return -i * 45;
  }
});


// highlight first circle and text
gsap.set(circles[0], { r: 48, fill: highlight, stroke: highlight });
gsap.set(text[0], { opacity: 1 });

//create the individual moves and add to the timeline
for (let i = 0; i < circles.length - 1; i++) {
  drawLength += pathSegment;
  tl.to(circles[i], { r: 20, fill: background }, "label" + i);
  tl.to(circles[i + 1], { r: 40, fill: highlight }, "label" + i);
  tl.to(text[i], { opacity: 0 }, "label" + i);
  tl.to(text[i + 1], { opacity: 1 }, "label" + i);
  tl.to("#motion-path", { drawSVG: drawLength }, "label" + i);
  tl.to({}, { duration: 2 });
}

              
            
!
999px

Console