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

              
                - var h = 2000, w = 2*h;
- var x = -.5*w, y = -.5*h;
- var r = .225*h;
- var nr = 20, a = Math.PI/nr;
- var asw = a*r;
- var sw = .004*h, fs = Math.round(.075*h);
- var na = Math.round(.05*fs);
- var rm = 2*(r + fs);
- var x0 = Math.round(rm*Math.cos(2*a));
- var y0 = Math.round(rm*Math.sin(2*a));
- var x1 = Math.round(rm*Math.cos(a));
- var y1 = Math.round(rm*Math.sin(a));
- var ra = rm - .5*fs;
- var xa0 = Math.round(ra*Math.cos(2*a));
- var ya0 = Math.round(ra*Math.sin(2*a));
- var xa1 = Math.round(ra*Math.cos(a));
- var ya1 = Math.round(ra*Math.sin(a));
- var xt0 = x1, yt0 = y1;
- var xt1 = Math.round(rm*Math.cos(.5*a));
- var yt1 = Math.round(rm*Math.sin(.5*a));
- var msx = Math.round(.7*xt1), msy = Math.round(.7*yt1);
- var mex = Math.round(.9*xt1), mey = Math.round(.9*yt1);
- var rb = 2*r + 4.5*fs;
- var xb0 = Math.round(rb*Math.cos(2*a));
- var yb0 = Math.round(rb*Math.sin(2*a));
- var xb1 = Math.round(rb*Math.cos(a));
- var yb1 = Math.round(rb*Math.sin(a));

svg(viewBox=[x, y, w, h].join(' ') 
		xmlns='http://www.w3.org/2000/svg')
	style
		| * {
		| 	fill: #333;
		| 	font: #{fs}px consolas, monaco, monospace
		| }
		| [id] + * { opacity: .5 }
		| #s + * { fill: #f90 }
		| #e + * { fill: #95a }
		| [x] ~ [d], [r] {
		| 	fill: none;
		| 	stroke: #ccc;
		| 	stroke-width: #{sw}
		| }
		| [r], [d] + [d] { stroke: #333 }
		| [r] {
		| 	stroke-width: #{2*r};
		| 	stroke-dasharray: #{asw.toFixed(2)}
		| }
		| [r] + [d] {
		| 	stroke: #b53;
		| 	stroke-width: #{Math.round(1.75*sw)};
		| 	stroke-linecap: round
		| }
		| [d] + [d] {
		| 	marker-start: url(#s);
		| 	marker-end: url(#e)
		| }
		| [r] ~ [x] {
		| 	fill: #b53;
		| 	font: #{fs}px comic sans ms, cursive
		| }
	marker#s(markerWidth=na markerHeight=na 
						viewBox='-8 -4 8 8' orient='auto' refX='-7')
		path(d='M-8 0 0-4V4')
	path(d=`M${xb0}${-yb0}A${rb} ${rb} 0 0 1 ${rb} 0H0`)
	marker#e(markerWidth=na markerHeight=na 
					 viewBox='0 -4 8 8' orient='auto' refX='7')
		path(d='M8 0 0-4V4')
	path(d=`M${xb1} ${yb1}A${rb} ${rb} 0 0 0 ${rb} 0H0`)
	text(x=-(x + 7*fs) y=y + fs) $p: 100%/$nr
	text(x=xt0 y=.3*fs - yt0) $p
	text(x=xt1 y=yt1 + .3*fs) $p/2
	path(d=`M${rm} 0H0L${x0}${-y0}M0 0L${x1} ${y1}`)
	circle(r=r)
	path(d=`M${-msx} ${msy}L${-mex} ${mey}
					M${-msx - .2*fs} ${msy - .2*fs}
					q${fs} ${.2*fs} 0 ${.4*fs}
					M${-msx}${-msy}L${-mex}${-mey}
					M${-msx - .2*fs} ${-msy - .2*fs}
					q${fs} ${.2*fs} 0 ${.4*fs}`)
	path(d=`M${xa0}${-ya0}A${ra} ${ra} 0 0 1 ${ra} 0`)
	path(d=`M${ra} 0A${ra} ${ra} 0 0 1 ${xa1} ${ya1}`)
	text(x=-(rm + fs) y=-.4*fs) ray
	text(x=-(rm + fs) y=.9*fs) gap

// minimal SVG
<svg viewBox='-2000 -1000 4000 2000' xmlns='http://www.w3.org/2000/svg'><style>*{fill:#333;font:150px consolas,monaco,monospace;}[id]+*{opacity:.5}#s+*{fill:#f90}#e+*{fill:#95a}[x]~[d],[r]{fill:none;stroke:#ccc;stroke-width:8}[r],[d]+[d]{stroke:#333}[r]{stroke-width:900;stroke-dasharray:70.69}[r]+[d]{stroke:#b53;stroke-width:14;stroke-linecap:round}[d]+[d]{marker-start:url(#s);marker-end:url(#e);}[r]~[x]{fill:#b53;font:150px comic sans ms,cursive}</style><marker id='s' markerWidth='8' markerHeight='8' viewBox='-8 -4 8 8' orient='auto' refX='-7'><path d='M-8 0 0-4V4'/></marker><path d='M1498-487A1575 1575 0 0 1 1575 0H0'/><marker id='e' markerWidth='8' markerHeight='8' viewBox='0 -4 8 8' orient='auto' refX='7'><path d='M8 0 0-4V4'/></marker><path d='M1556 246A1575 1575 0 0 0 1575 0H0'/><text x='950' y='-850'>$p:100%/$nr</text><text x='1185' y='-143'>$p</text><text x='1196' y='139'>$p/2</text><path d='M1200 0H0L1141-371M0 0L1185 188'/><circle r='450'></circle><path d='M-837 66L-1076 85M-867 36q150 30 0 60M-837-66L-1076-85M-867-96q150 30 0 60'/><path d='M1070-348A1125 1125 0 0 1 1125 0'/><path d='M1125 0A1125 1125 0 0 1 1111 176'/><text x='-1350' y='-60'>ray</text><text x='-1350' y='135'>gap</text></svg>
              
            
!

CSS

              
                body {
	display: flex;
	flex-direction: column;
	margin: 0;
	height: 100vh;
}
              
            
!

JS

              
                
              
            
!
999px

Console