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_h = Math.round((2*Math.cos(0) + 1)*vb_u);
- var vb_w = Math.round(vb_h/.6);
- var ng = 6, ix = .5*ng + 1, gux = vb_u/ix, guy = .5*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;
- var ax_x0 = vb_x + k*vb_w, ax_x1 = (.5 - k)*vb_w + 2*mx - vb_u;
- var ax_y = (1 - k)*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 = Math.round(.1*k*vb_w), pr1 = Math.round(5*pr/7);
- var na = 2*pr, fs = 3*na;

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 }
		| [r] + [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=na height=na patternUnits='userSpaceOnUse' 
						patternTransform='rotate(45)')
		rect(width=na height=Math.round(.2*na))
	linearGradient#g
		stop(stop-color='#ccc' offset=(1 - ix/ng).toFixed(2))
		stop(stop-color='#95a' offset=0)
	
	- var gd = [];
	- for(var i = 0; i < ix; i++) {
		- gd.push(`M${Math.round((i + 1)*gux)}${-vb_u}V${vb_u}`);
		- if(i < 4) gd.push(`M0 ${(~~(.5*i) + 1)*Math.pow(-1, i%2)*guy}H${vb_u}`);
	- }
	path(d=gd.join(''))
	
	text(x=.5*fs y=(.7*fs + ax_y)) sin((1-<tspan>k</tspan>)·<tspan>s</tspan>)
	path(d=`M0 ${-ax_y}V${ax_y}`)
	text(x=(ax_x1 - .5*fs) y=-.5*fs): tspan k
	path(d=`M${ax_x0} 0H${ax_x1}`)
	
	circle(r=pr1 cy=-vb_u)
	text(x=-.8*fs y=Math.round(-.3*fs)) 0
	circle(r=pr1 cy=vb_u)
	
	path(d=`M${px} ${py}V0H0V${py}z`)
	path(d=`M${vb_u - 2*mx} 0C${Math.round(cp1/a - (2*mx - vb_u))} ${cp1} ${cp2 - (2*mx - vb_u)} ${vb_u} ${mx - (2*mx - vb_u)} ${vb_u}C${cp3 - (2*mx - vb_u)} ${vb_u} ${Math.round(cp4 - (2*mx - vb_u))} ${cp1} ${2*mx - (2*mx - vb_u)} 0`)
	
	circle(r=pr1 cx=0)
	circle(r=pr1 cx=vb_u - mx cy=vb_u)
	circle(r=pr1 cx=vb_u - mx)
	circle(r=pr1 cx=px)
	circle(r=pr1 cy=py)
	circle(r=pr1 cx=vb_u - 2*mx)
	circle(r=pr cy=py)
	circle(r=pr cx=px)
	
	text(x=-3.5*fs y=Math.round(.25*fs + py)) sin(<tspan>s</tspan>)
	text(x=-1.3*fs y=Math.round(.25*fs + vb_u)) -1
	text(x=-.8*fs y=Math.round(.25*fs - vb_u)) 1
	text(x=Math.round(vb_u + .3*fs) y=Math.round(-.3*fs)) 1

// minimal SVG
<svg viewBox='-2000 -1500 5000 3000' xmlns='http://www.w3.org/2000/svg'><style>*{vector-effect:non-scaling-stroke;font:150px consolas,monaco,monospace;letter-spacing:-30}#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}[r]+[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='50' markerHeight='50' viewBox='0 -4 8 8' orient='auto' refX='7'><path d='M8 0 0-4V4'/></marker><pattern id='p' width='50' height='50' patternUnits='userSpaceOnUse' patternTransform='rotate(45)'><rect width='50' height='10'/></pattern><linearGradient id='g'><stop stop-color='#ccc' offset='.33'/><stop stop-color='#95a' offset='0'/></linearGradient><path d='M250-1000V1000M0 500H1000M500-1000V1000M0-500H1000M750-1000V1000M0 1000H1000M1000-1000V1000M0-1000H1000'/><text x='75' y='-1320'>sin((1-<tspan>k</tspan>)·<tspan>s</tspan>)</text><path d='M0 1425V-1425'/><text x='2675' y='-75'><tspan>k</tspan></text><path d='M-1750 0H2750'/><circle r='18' cy='-1000'/><text x='-120' y='-45'>0</text><circle r='18' cy='1000'/><path d='M1000 866V0H0V866z'/><path d='M-500 0C-439 128-87 1000 250 1000C587 1000 939 128 1000 0'/><circle r='18' cx='0'/><circle r='18' cx='250' cy='1000'/><circle r='18' cx='250'/><circle r='18' cx='1000'/><circle r='18' cy='866'/><circle r='18' cx='-500'/><circle r='25' cy='866'/><circle r='25' cx='1000'/><text x='-525' y='904'>sin(<tspan>s</tspan>)</text><text x='-195' y='1038'>-1</text><text x='-120' y='-962'>1</text><text x='1045' y='-45'>1</text></svg>
              
            
!

CSS

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

JS

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

Console