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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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 vb_u = 1000;
- var na = .056*vb_u*.5, k = .025;
- var vb_w = .5*Math.ceil(2*Math.PI)*vb_u;
- var vb_h = (2*Math.cos(0))*vb_u;
- var sa = -2*Math.PI/3, ea = 5*Math.PI/6;
- var da = ea - sa, un = 12, ua = 2*Math.PI/un;
- var ex = Math.round(da*vb_u/da);
- var ey = -Math.round(Math.sin(ea)*vb_u);
- var sy = -Math.round(Math.sin(sa)*vb_u);
- var dy = ey - sy;
- var vb_x = -.5*vb_w - sa/da*vb_u;
- var vb_y = -.5*vb_h + sy/dy*vb_u;
- var fs = .056*.5*3*vb_u;
- var ax_x0 = Math.round(vb_x + k*vb_w);
- var ax_y0 = Math.round(vb_y + 2*k*vb_h);
- var ax_x1 = Math.round(.5*vb_w - sa/da*vb_u - k*vb_w);
- var ax_y1 = Math.round(.5*vb_h + sy/dy*vb_u - k*vb_h);
- var pr = Math.round(.03*.5*vb_u);
- var pr1 = Math.round(.65*pr), ps = 2*pr;
- var qx0 = (Math.PI - ea)*vb_u/da;
- var qx1 = (2*Math.PI - ea)*vb_u/da;
- var mx0 = (.5*Math.PI - ea)*vb_u/da;
- var mx1 = (1.5*Math.PI - ea)*vb_u/da;
- var mx2 = (2.5*Math.PI - ea)*vb_u/da;
- var cp1 = .07*.5*Math.PI*vb_u/da;
- var cp2 = .45*.5*Math.PI*vb_u/da;
- var ss = +((Math.PI + sa)/2/Math.PI).toFixed(2);
- var se = +((Math.PI + ea)/2/Math.PI).toFixed(2);

svg(viewBox=[Math.round(vb_x), Math.round(vb_y), vb_w, vb_h].join(' ')
		 xmlns='http://www.w3.org/2000/svg')
	style
		| * {
		|   vector-effect: non-scaling-stroke;
		|   font: #{fs}px consolas, monaco, monospace;
		|   letter-spacing: #{-fs/5}
		| }
		| #e [d] { fill: #333 }
		| #g + * { stroke: #ccc }
		| [x] + [d], [r] {
		|   stroke: #333;
		|   marker-end: url(#e)
		| }
		| tspan { font-style: italic }
		| [x] + [d], [r] + [d], [r] { stroke-width: 2 }
		| [d] + [d] {
		| 	fill: url(#p);
		| 	stroke: #e83;
		| 	stroke-dasharray: 8
		| }
		| #p *, [r] { fill: #e83 }
		| [r] + [d] {
		|   fill: none;
		| 	stroke-width: 4;
		| 	stroke: url(#g)
		| }
		| @supports not (vector-effect: non-scaling-stroke) {
		| 	[d][d] { stroke-width: 14; marker: none }
		| }
	marker#e(markerWidth=na markerHeight=na 
						viewBox='0 -4 8 8' 
						orient='auto' refX='7')
		path(d='M8 0 0-4V4')
	pattern#p(width=ps height=ps patternUnits='userSpaceOnUse' patternTransform='rotate(45)')
		rect(width=ps height=Math.round(.2*ps))
	linearGradient#g
		stop(stop-color='#ccc' offset=ss)
		stop(stop-color='#a57' offset=0)
		stop(stop-color='#a57' offset=se)
		stop(stop-color='#ccc' offset=0)
	
	- var gd = [], p = [];
	- for(var i = 0; i <= un; i++) {
		- var ca = i*ua - sa - Math.PI;
		- var x = Math.round(ca/da*vb_u);
		- if(x) gd.push(`M${x}${Math.round((vb_u + sy)/dy*vb_u)}V0`);
		- if(i <= .5*un) {
			- var y = Math.round((Math.cos(i*ua)*vb_u - sy)/-dy*vb_u);
			- if(y) gd.push(`M${ax_x0} ${y}H${ax_x1}`)
		- }
	- }
	path(d=gd.join(''))
	
	text(x=.5*fs y=(.5*fs + ax_y0)) (sin(<tspan>k</tspan>·(<tspan>e</tspan>-<tspan>s</tspan>)+<tspan>s</tspan>)-sin(<tspan>s</tspan>))/(sin(<tspan>e</tspan>)-sin(<tspan>s</tspan>))
	path(d=`M${ax_x0} 0H${ax_x1}`)
	text(x=(ax_x1 - .5*fs) y=-.5*fs): tspan k
	path(d=`M0 ${ax_y1}V${ax_y0}`)
	
	path(d=`M0${-vb_u}H${ex}V0H0z`)
	
	circle(r=pr1 cy=-vb_u)
	circle(r=pr1 cx=ex)
	circle(r=pr1 cx=Math.round(qx1))
	circle(r=pr1 cx=Math.round(qx0))
	circle(r=pr1 cx=Math.round(mx2))
	circle(r=pr1 cx=Math.round(mx0))
	
	path(d=`M${Math.round(mx0)} ${Math.round(sy/dy*vb_u)}
					C${Math.round(mx0 + cp1)} ${Math.round((cp1 - sy)/-dy*vb_u)}
					 ${Math.round(qx0 - cp2)} ${Math.round((vb_u - sy)/-dy*vb_u)}
					 ${Math.round(qx0)} ${Math.round((vb_u - sy)/-dy*vb_u)}
					C${Math.round(qx0 + cp2)} ${Math.round((vb_u - sy)/-dy*vb_u)}
					 ${Math.round(mx1 - cp1)} ${Math.round((cp1 - sy)/-dy*vb_u)}
					 ${Math.round(mx1)} ${Math.round(sy/dy*vb_u)}
					C${Math.round(mx1 + cp1)} ${Math.round((cp1 + sy)/dy*vb_u)}
					 ${Math.round(qx1 - cp2)} ${Math.round((vb_u + sy)/dy*vb_u)}
					 ${Math.round(qx1)} ${Math.round((vb_u + sy)/dy*vb_u)}
					C${Math.round(qx1 + cp2)} ${Math.round((vb_u + sy)/dy*vb_u)}
					 ${Math.round(mx2 - cp1)} ${Math.round((cp1 + sy)/dy*vb_u)}
					 ${Math.round(mx2)} ${Math.round(sy/dy*vb_u)}`)
	
	circle(r=pr1 cx=Math.round(qx1) cy=Math.round((vb_u + sy)/dy*vb_u))
	circle(r=pr1 cx=Math.round(mx0) cy=Math.round(sy/dy*vb_u))
	circle(r=pr cx=Math.round(mx1) cy=Math.round(sy/dy*vb_u))
	circle(r=pr1 cx=Math.round(mx2) cy=Math.round(sy/dy*vb_u))
	circle(r=pr1 cx=Math.round(qx0) cy=Math.round((vb_u - sy)/-dy*vb_u))
	circle(r=pr cx=ex cy=-vb_u)
	circle(r=pr)
	
	text(x=-Math.round(.7*fs) y=Math.round(.9*fs)) 0
	text(x=-Math.round(.7*fs) y=Math.round(-vb_u + .3*fs)) 1
	text(x=Math.round(ex - .3*fs) y=Math.round(.9*fs)) 1

// minimal SVG
<svg viewBox='-1306 -1634 3500 2000' xmlns='http://www.w3.org/2000/svg'><style>*{vector-effect:non-scaling-stroke;font:84px consolas,monaco,monospace;letter-spacing:-16.8}#e [d]{fill:#333}#g+*{stroke:#ccc}[x]+[d],[r]{stroke:#333;marker-end:url(#e)}tspan{font-style:italic}[x]+[d],[r]+[d],[r]{stroke-width:2}[d]+[d]{fill:url(#p);stroke:#e83;stroke-dasharray:8}#p *,[r]{fill:#e83}[r]+[d]{fill:none;stroke-width:4;stroke:url(#g)}@supports not (vector-effect:non-scaling-stroke){[d][d]{stroke-width:14;marker:none}}</style><marker id='e' markerWidth='28' markerHeight='28' viewBox='0 -4 8 8' orient='auto' refX='7'><path d='M8 0 0-4V4'/></marker><pattern id='p' width='30' height='30' patternUnits='userSpaceOnUse' patternTransform='rotate(45)'><rect width='30' height='6'/></pattern><linearGradient id='g'><stop stop-color='#ccc' offset='.17'/><stop stop-color='#a57' offset='0'/><stop stop-color='#a57' offset='.92'/><stop stop-color='#ccc' offset='0'/></linearGradient><path d='M-222-1366V0M-1218 98H2107M-111-1366V0M-1218-268H2107M111-1366V0M-1218-634H2107M222-1366V0M-1218-1000H2107M333-1366V0M-1218-1268H2107M444-1366V0M-1218-1366H2107M556-1366V0M667-1366V0M778-1366V0M889-1366V0M1000-1366V0M1111-1366V0'/><text x='42' y='-1492'>(sin(<tspan>k</tspan>·(<tspan>e</tspan>-<tspan>s</tspan>)+<tspan>s</tspan>)-sin(<tspan>s</tspan>))/(sin(<tspan>e</tspan>)-sin(<tspan>s</tspan>))</text><path d='M-1218 0H2107'/><text x='2065' y='-42'><tspan>k</tspan></text><path d='M0 316V-1534'/><path d='M0-1000H1000V0H0z'/><circle r='10' cy='-1000'/><circle r='10' cx='1000'/><circle r='10' cx='778'/><circle r='10' cx='111'/><circle r='10' cx='1111'/><circle r='10' cx='-222'/><path d='M-222-634C-199-617-39 98 111 98C261 98 421-617 444-634C468-651 628-1366 778-1366C928-1366 1088-651 1111-634'/><circle r='10' cx='778' cy='-1366'/><circle r='10' cx='-222' cy='-634'/><circle r='15' cx='444' cy='-634'/><circle r='10' cx='1111' cy='-634'/><circle r='10' cx='111' cy='98'/><circle r='15' cx='1000' cy='-1000'/><circle r='15'/><text x='-59' y='76'>0</text><text x='-59' y='-975'>1</text><text x='975' y='76'>1</text></svg>
              
            
!

CSS

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

JS

              
                // minimal SVG https://codepen.io/thebabydino/pen/YrYwZM
              
            
!
999px

Console