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 = 2000, na = .025*vb_u, k = .05, fs = .06*vb_u;
- var vb_h = Math.round((2*Math.cos(0) + 1)*.5*vb_u);
- var vb_w = Math.round(vb_h/.6);
- var ng = 6, ix = .5*ng + 1, gux = vb_u/ix, guy = .25*vb_u;
- var px = Math.round(ix*gux), a = ix*Math.PI/ng;
- var py = Math.round(Math.sin(a)*vb_u), mx = .5*ng*gux;
- var vb_x = -(.5*vb_w - 2*vb_u + 2*mx), vb_y = -.5*(vb_h + vb_u);
- var ax_x0 = vb_x + k*vb_w, ax_x1 = (1 - 2*k)*vb_w + vb_x;
- var ax_y0 = vb_y + k*vb_h, ax_y1 = (1 - 2*k)*vb_h + vb_y;
- var cp1 = Math.round(.17*mx), cp2 = Math.round(.55*mx);
- var cp3 = 2*mx - cp2, cp4 = 2*mx - cp1/a;
- var pr = .012*vb_u, ps = 2*pr, pr1 = Math.round(.65*pr);

svg(viewBox=[vb_x, 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 }
		| [id=i] {
		| 	fill: url(#p);
		| 	stroke: #e83;
		| 	stroke-dasharray: 8
		| }
		| #p *, [r] { fill: #e83 }
		| [id=i] + [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=(1 - ix/ng).toFixed(2))
		stop(stop-color='#95a' offset=0)
	
	- var gd = [];
	- for(var i = 1; i <= ix; i++) {
		- gd.push(`M${Math.round(i*gux)}${-vb_u}V0`);
		- gd.push(`M0 ${-i*guy}H${vb_u}`);
	- }
	path(d=gd.join(''))
	
	text(x=.5*fs y=(.5*fs + ax_y0)) 1-sin((1-<tspan>k</tspan>)·<tspan>s</tspan>)/sin(<tspan>s</tspan>)
	path(d=`M0 ${ax_y1}V${ax_y0}`)
	text(x=(ax_x1 - .5*fs) y=-.5*fs): tspan k
	path(d=`M${ax_x0} 0H${ax_x1}`)
		
	path#i(d=`M${px}${-vb_u}V0H0V${-vb_u}z`)
	path(d=`M${vb_u - 2*mx}${-vb_u}C${Math.round(cp1/a - (2*mx - vb_u))} ${Math.round((cp1 - py)/py*vb_u)} ${Math.round(cp2 - (2*mx - vb_u))} ${Math.round((vb_u - py)/py*vb_u)} ${mx - (2*mx - vb_u)} ${Math.round((vb_u - py)/py*vb_u)}C${cp3 - (2*mx - vb_u)} ${Math.round((vb_u - py)/py*vb_u)} ${Math.round(cp4 - (2*mx - vb_u))} ${Math.round((cp1 - py)/py*vb_u)} ${2*mx - (2*mx - vb_u)}${-vb_u}`)
	
	circle(r=pr1 cy=-vb_u)
	circle(r=pr1 cx=vb_u - mx cy=Math.round((vb_u - py)*vb_u/py))
	circle(r=pr1 cx=vb_u - mx)
	circle(r=pr1 cx=px)
	circle(r=pr)
	circle(r=pr cx=px cy=-vb_u)
	
	text(x=-.8*fs y=Math.round(.25*fs - vb_u)) 1
	text(x=-.8*fs y=Math.round(.9*fs)) 0
	text(x=Math.round(vb_u + .3*fs) y=Math.round(-.3*fs)) 1

// minimal SVG
<svg viewBox='-1500 -2500 5000 3000' xmlns='http://www.w3.org/2000/svg'><style>*{vector-effect:non-scaling-stroke;font:120px consolas,monaco,monospace;letter-spacing:-24}#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}[id=i]{fill:url(#p);stroke:#e83;stroke-dasharray:8}#p *,[r]{fill:#e83}[id=i]+[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='50' markerHeight='50' viewBox='0 -4 8 8' orient='auto' refX='7'><path d='M8 0 0-4V4'/></marker><pattern id='p' width='48' height='48' patternUnits='userSpaceOnUse' patternTransform='rotate(45)'><rect width='48' height='10'/></pattern><linearGradient id='g'><stop stop-color='#ccc' offset='.33'/><stop stop-color='#95a' offset='0'/></linearGradient><path d='M500-2000V0M0-500H2000M1000-2000V0M0-1000H2000M1500-2000V0M0-1500H2000M2000-2000V0M0-2000H2000'/><text x='60' y='-2290'>1-sin((1-<tspan>k</tspan>)·<tspan>s</tspan>)/sin(<tspan>s</tspan>)</text><path d='M0 200V-2350'/><text x='2940' y='-60'><tspan>k</tspan></text><path d='M-1250 0H3000'/><path id='i' d='M2000-2000V0H0V-2000z'/><path d='M-1000-2000C-878-1706-175 309 500 309C1175 309 1878-1706 2000-2000'/><circle r='16' cy='-2000'/><circle r='16' cx='500' cy='309'/><circle r='16' cx='500'/><circle r='16' cx='2000'/><circle r='24'/><circle r='24' cx='2000' cy='-2000'/><text x='-96' y='-1970'>1</text><text x='-96' y='108'>0</text><text x='2036' y='-36'>1</text></svg>
              
            
!

CSS

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

JS

              
                // minimal SVG https://codepen.io/thebabydino/pen/zdbPpJ?editors=1000
              
            
!
999px

Console