Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <div class="brand" style="background:black; text-align:center;"><a href="https://www.creativecodingclub.com/bundles/creative-coding-club?src=blobcdp" target="_blank"><img src="https://assets.codepen.io/32887/logo-ill.svg" width="300" alt="" /></a></div>
<div class="demo">
	<svg viewBox="0 0 500 300" xmlns="http://www.w3.org/2000/svg">
  <defs></defs>
  <path style="fill: none; stroke-width: 5px; stroke: rgb(144, 141, 141);" d="M 351.8083 69.1945 C 422.1606 69.1945 452.1813 152.7418 426.3861 219.5199 C 405.0252 274.8184 337.3086 293.2454 291.7926 256.1453 C 257.7861 228.4267 237.5661 185.2092 174.1128 219.11 C 112.7792 251.8783 41.8145 190.9837 58.0919 122.3275 C 62.0722 105.5392 70.6161 90.238 82.741 78.1835 C 124.6481 36.5197 192.571 40.5485 229.4636 86.8863 C 257.1423 121.7631 305.7904 70.9843 351.8083 69.1945 Z" class="myPath"></path>
</svg>
</div>

              
            
!

CSS

              
                body {
	background:#1d1d1d;
	margin:0;
}

.demo {
	opacity:0;
}

.demo svg {
	overflow:visible;
}
              
            
!

JS

              
                gsap.set(".demo", { opacity: 1 });
const svg = document.querySelector(".demo svg")
const ns = "http://www.w3.org/2000/svg"
const tl = gsap.timeline({id:"path followers"});

// need help learning GSAP?
// my GSAP Course Bundle can help
// https://www.creativecodingclub.com/bundles/creative-coding-club
// Unlock over 240 Premium GSAP lessons today


function createCircles(numCircles) {
	for (let i = 0; i < numCircles; i++) {
		let newCircle = document.createElementNS(ns, "circle")
  
		newCircle.setAttributeNS(null, "cx", 100)
		newCircle.setAttributeNS(null, "cy", 100)
		newCircle.setAttributeNS(null, "r", 20)
		newCircle.setAttributeNS(null, "stroke", "white")
		newCircle.setAttributeNS(null, "stroke-width", 4)
		svg.appendChild(newCircle)
		let start = i/numCircles // secret sauce for circles
		gsap.set(newCircle, {fill:`hsl(${(i/numCircles) * 360}, 80%, 50%)`})
		tl.to(newCircle, {
    		motionPath: {
      		path: ".myPath",
      		align: ".myPath",
      		alignOrigin: [0.5, 0.5],
      		start:start,
      		end:start + 1
    }, ease:"none", duration:8, repeat:20
  }, 0)
		tl.to(newCircle, {scale:2, duration:1, repeat:80, repeatDelay:1, yoyo:true}, i*0.5)
	}
}

createCircles(16);



GSDevTools.create({animation:tl});
gsap.config({trialWarn:false});

              
            
!
999px

Console