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="wrapper">
	<div class="grids polygons"><div></div></div>
	<div class="grids polygons"><div></div></div>
	<div class="grids polygons"><div></div></div>
</div>
<div class="wrapper">
	<div class="graphs polygons"><div><!-- Set 1 --></div></div>
	<div class="graphs polygons"><div><!-- Set 2 --></div></div>
	<div class="graphs polygons"><div><!-- Set 3 --></div></div>
	<!-- add here more graphs -->
</div>
              
            
!

CSS

              
                /* polygon graphs */
.graphs:nth-of-type(1) > div{ background: var(--color1); }
.graphs:nth-of-type(2)> div{ background: var(--color2); }
.graphs:nth-of-type(3) > div{ background: var(--color3); }
.graphs{
	filter: 
	drop-shadow(1px 1px 10px var(--colorS))
	drop-shadow(-1px -1px 10px var(--colorS))
	drop-shadow(-1px 1px 10px var(--colorS))
	drop-shadow(1px -1px 10px var(--colorS));
}

/* polygon grids */
.grids {
	filter: 
	drop-shadow(1px 1px 1px #ddd)
	drop-shadow(-1px -1px 1px #ddd)
	drop-shadow(-1px 1px 1px #ddd)
	drop-shadow(1px -1px 1px #ddd);
	mix-blend-mode: multiply;
}
.grids:nth-of-type(2) { width: 66%; }
.grids:nth-of-type(3) { width: 33%; }
.grids > div { background: white; }

/* all polygons */
.polygons { place-self: center;	 }
.polygons > div { width: 100%; }

/* other styles */
.wrapper{ display: grid; }
div {
	width: 300px;
	aspect-ratio: 1 / 1;
	grid-area: 1 / 1;
}
body {
	display: grid;
	place-content: center;
	height: 100vh;
	font: 14pt 'crimson pro';
	--color1: rgba(78, 36, 221, 0.6);
	--color2: rgba(236, 19, 154, 0.6);
	--color3: rgba(156, 4, 223, 0.6);
	--colorS: rgba(255, 0, 95, 0.1);
}
              
            
!

JS

              
                onload= ()=>{
let sides = 5; // no. of data points (increment this to add more data)
let units = 4; // no. of graphs + 1 (increment this to add more graph)
let vertices = (new Array(units)).fill(""); 
let percents = new Array(units);
percents[0] = (new Array(sides)).fill(100); // for the polygon's grid
// each graph's data points in the order [B, C, D... A] 
percents[1] = [100, 50, 60, 50, 90]; 
percents[2] = [100, 80, 30, 90, 40];
percents[3] = [100, 10, 60, 60, 80];
// (add to percents[] to add a new graph's data points)
let gradient = "conic-gradient(";
let angle = 360/sides;

/* calculate vertices */
with(Math){for(i=0,n=2*PI;i<sides;i++,n+=2*PI){
	for(j=0;j<units;j++){
		let x = (round(cos(-1*PI/2 + n/sides) * percents[j][i]) + 100) / 2; 
 		let y = (round(sin(-1*PI/2 + n/sides) * percents[j][i]) + 100) / 2; 
		vertices[j] += `${x}% ${y}${i==sides-1 ? '%':'%, '}`;
	}
	gradient += `white ${(angle*(i+1))-1}deg,#ddd ${(angle*(i+1))-1}deg,#ddd ${(angle*(i+1))+1}deg,white ${(angle*(i+1))+1}deg,`;
}}

/* draw polygons (grids + graphs) */
document.querySelectorAll('.graphs>div').forEach((graph,i)=>{graph.style.clipPath =`polygon(${vertices[i+1]})`;});
document.querySelectorAll('.grids>div').forEach((grid,i)=>{grid.style.clipPath =`polygon(${vertices[0]})`;});
document.querySelector('.grids:nth-of-type(1)>div').style.background =`${gradient.slice(0, -1)})`;
}
              
            
!
999px

Console