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.


                <svg id="svgMain" viewBox="0 0 500 500" height="500" width="500" x="0" y="0" >
    <filter id="gloop" height="125%">
      <feGaussianBlur in="SourceGraphic" stdDeviation=15 result="blur" />
      <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 50 -20" result="goo" />
  <g id="svgGroup" filter="url(#gloop)"></g>

<svg id="svgRight" viewBox="0 0 500 500" height="500" width="500" x="0" y="0" >
  <use href="#svgGroup"/>


                body {
  margin: 0;
  display: flex;
  align-items: center;
  height: 100vh;
  background: #ffffff;
  cursor: pointer;

  height: 100vh;
  min-height: 400px;

#svgRight {
  transform: scaleX(-1);

/* Before using SMIL, I used CSS animation to fade in the circles. The browser support was spotty, so I changed to SMIL. But for some reason, keeping this CSS animation here but commented out allows the codepen preview snapshot to animate */
  animation: fadeIn 200ms;

@keyframes fadeIn {
  from {
    opacity: 0;
  to {
    opacity: 1;
} */


                const body = document.body;
const group = document.getElementById("svgGroup");

// Instructions for making a circle
function drawCircle() { 
  // Make SVG circle
  let circle = document.createElementNS("", "circle");
  circle.setAttribute("r", Math.floor(Math.random() * 60));
  circle.setAttribute("cx", Math.floor(Math.random() * 500) + 150); 
  circle.setAttribute("cy", Math.floor(Math.random() * 500));
  circle.setAttribute("opacity", "1" );
  circle.setAttribute("fill", "black");
  // Make SMIL animation
  let animation = document.createElementNS("", "animate");
  animation.setAttribute("attributeName", "opacity");
  animation.setAttribute("from", "0"); 
  animation.setAttribute("to", "1");
  animation.setAttribute("fill", "freeze");
  animation.setAttribute("dur", "200ms"); 
  // Append animation to circle, append circle to g
  // Begin animation

// Draw a random circle every 5 milliseconds until limit is reached
function drawRandom() { 
  for (i = 0; i < 50; i++) {
    setTimeout( function timer(){
    }, i*3 );

//Remove all SVG shapes from DOM
function removeAll() {
  while (group.firstChild) {

//On click, remove all shapes and draw new shapes
body.addEventListener("click", function(){

//On page load, draw new shapes