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, k = .05;
- var vb_w = Math.ceil(2*Math.PI)*vb_u;
- var pr = Math.round(.1*k*vb_w), na = Math.round(2*pr);
- var vb_h = (2*Math.cos(0) + 1)*vb_u;
- var vb_x = -.5*vb_w, vb_y = -.5*vb_h;
- var ax_x = (k - 1)*vb_x, ax_y = (k - 1)*vb_y;
- var ka = 6, au = Math.PI/ka;
- var px = Math.round((.5*Math.PI)*vb_u);
- var py = Math.round(vb_u*Math.cos(0));
- var kg = 40, gu = Math.PI/kg;
- var gy = Math.round(Math.cos(0)*vb_u);
- var fs = 3*na, ps = 2*pr, pr1 = Math.round(5*pr/7);
- var cp1 = Math.round(.17*px), cp2 = Math.round(.59*px);

svg(viewBox=[vb_x, vb_y, vb_w, vb_h].join(' ')
		 xmlns='http://www.w3.org/2000/svg'
		 xmlns:xlink='http://www.w3.org/1999/xlink')
	style
		| [d], [r] {
		|   fill: none;
		| 	stroke: #ccc;
		|   vector-effect: non-scaling-stroke
		| }
		| [d] { mix-blend-mode: darken }
		| [x] {
		|   font: #{fs}px consolas, monaco, monospace;
		|   letter-spacing: #{-fs/5}
		| }
		| #e [d] { fill: #333; stroke: none }
		| [d] + [x], tspan { font-style: italic }
		| use + [d], [x] + [d], [r] { stroke-width: 2 }
		| [x] + [d], [r] {
		| 	stroke: #333;
		| 	marker-end: url(#e)
		| }
		| [id=v] [d] { stroke-width: 4 }
		| g * + [d] { stroke: #a57 }
		| [d] + [d] {
		| 	fill: url(#p);
		| 	stroke: #e83;
		| 	stroke-dasharray: 8
		| }
		| #p *, [r] { fill: #e83 }
		| @supports not (vector-effect: non-scaling-stroke) {
		| 	[d][d] { stroke-width: 19; 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=na height=na patternUnits='userSpaceOnUse' patternTransform='rotate(45)')
		rect(width=ps height=Math.round(.2*na))
	
	- var gd = [];
	- for(var i = 0; i <= ka; i++) {
		- var ca = i*au;
		- var cx = Math.round(ca*vb_u);
		- var cy = Math.round(Math.cos(ca)*vb_u);
		- if(ca > 0) {
			- gd.push(`M${cx} ${gy}V${-gy}`);
		- }
		- if(cy < 0) {
			- gd.push(`M${-ax_x} ${cy}H${ax_x}`)
		-}
	- }
	path#u(d=gd.join(''))
	
	use(xlink:href='#u' transform='rotate(180)')
	
	text(x=.5*fs y=(.7*fs - ax_y)) sin(<tspan>k</tspan>)
	path(d=`M0 ${ax_y}V${-ax_y}`)
	text(x=(ax_x - .5*fs) y=-.5*fs) k
	path(d=`M${-ax_x} 0H${ax_x}`)
	
	path(d=`M${-px}${-py}H${px}V${py}H${-px}z`)
	
	g#v
		path(d=`M${2*px} 0 C${2*px - cp1} ${-cp1} ${2*px - cp2} ${-py} ${px}${-py}`)
		circle(r=pr1 cx=px)
		path(d=`M0 0 C${cp1} ${-cp1} ${cp2} ${-py} ${px}${-py}`)
		circle(r=pr cx=px cy=-py)
		circle(r=pr cx=2*px)
		circle(r=pr1 cy=py)
	
	use(xlink:href='#v' transform='rotate(180)')
	circle(r=pr)
	
	text(x=(px + .2*fs) y=Math.round(.9*fs)) 90°
	text(x=-(2.3*fs + px) y=Math.round(-.2*fs)) -90°
	text(x=-.75*fs y=-Math.round(py + .2*fs)) 1
	text(x=Math.round(.1*fs) y=Math.round(py + .9*fs)) -1
	
// minimal SVG
<svg viewBox='-3500 -1500 7000 3000' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><style>[d],[r]{fill:none;stroke:#ccc;vector-effect:non-scaling-stroke}[d]{mix-blend-mode:darken}[x]{font:210px consolas,monaco,monospace;letter-spacing:-42}#e [d]{fill:#333;stroke:none}[d]+[x],tspan{font-style:italic}use+[d],[x]+[d],[r]{stroke-width:2}[x]+[d],[r]{stroke:#333;marker-end:url(#e)}[id=v] [d]{stroke-width:4}g *+[d]{stroke:#a57}[d]+[d]{fill:url(#p);stroke:#e83;stroke-dasharray:8}#p *,[r]{fill:#e83}@supports not (vector-effect:non-scaling-stroke){[d][d]{stroke-width:19;marker:none}}</style><marker id='e' markerWidth='70' markerHeight='70' viewBox='0 -4 8 8' orient='auto' refX='7'><path d='M8 0 0-4V4'/></marker><pattern id='p' width='70' height='70' patternUnits='userSpaceOnUse' patternTransform='rotate(45)'><rect width='70' height='14'/></pattern><path id='u' d='M524 1000V-1000M1047 1000V-1000M1571 1000V-1000M2094 1000V-1000M-3325-500H3325M2618 1000V-1000M-3325-866H3325M3142 1000V-1000M-3325-1000H3325'/><use xlink:href='#u' transform='rotate(180)'/><text x='105' y='-1278'>sin(<tspan>k</tspan>)</text><path d='M0 1425V-1425'/><text x='3220' y='-105'>k</text><path d='M-3325 0H3325'/><path d='M-1571-1000H1571V1000H-1571z'/><g id='v'><path d='M3142 0 C2875-267 2215-1000 1571-1000'/><circle r='25' cx='1571'/><path d='M0 0 C267-267 927-1000 1571-1000'/><circle r='35' cx='1571' cy='-1000'/><circle r='35' cx='3142'/><circle r='25' cy='1000'/></g><use xlink:href='#v' transform='rotate(180)'/><circle r='35'/><text x='1613' y='189'>90°</text><text x='-2054' y='-42'>-90°</text><text x='-157.5' y='-1042'>1</text><text x='21' y='1189'>-1</text></svg>
              
            
!

CSS

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

JS

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

Console