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 vb_x = -(.5*vb_w + vb_u), vb_y = -.5*vb_h;
- var ax_x0 = vb_x + k*vb_w, ax_x1 = (.5 - k)*vb_w - vb_u;
- var ax_y = (1 - k)*vb_y;
- 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 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 < ng; 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${-2*vb_u}`);
	- }
	path(d=gd.join(''))
	
	text(x=.5*fs y=(.7*fs + ax_y)) sin(-<tspan>k·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=.3*fs y=Math.round(-.3*fs)) 0
	circle(r=pr1 cy=vb_u)
	
	path(d=`M${px} ${py}V0H0V${py}z`)
	path(d=`M0 0C${-Math.round(cp1/a)} ${cp1} ${-cp2} ${vb_u} ${-mx} ${vb_u}C${-cp3} ${vb_u} ${-Math.round(cp4)} ${cp1} ${-2*mx} 0`)
	
	circle(r=pr1 cx=-vb_u)
	circle(r=pr1 cx=-mx cy=vb_u)
	circle(r=pr1 cx=-mx)
	circle(r=pr1 cx=px)
	circle(r=pr1 cy=py)
	circle(r=pr1 cx=-2*mx)
	circle(r=pr)
	circle(r=pr cx=px cy=py)
	
	text(x=.3*fs y=Math.round(.25*fs + py)) sin(<tspan>s</tspan>)
	text(x=.3*fs y=Math.round(.25*fs + vb_u)) -1
	text(x=.3*fs y=Math.round(.25*fs - vb_u)) 1
	text(x=-Math.round(.5*fs + vb_u) y=Math.round(-.3*fs)) -1

// minimal SVG
<svg viewBox='-3500 -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='M-250-1000V1000M0 500H-2000M-500-1000V1000M0-500H-2000M-750-1000V1000M0 1000H-2000M-1000-1000V1000M0-1000H-2000M-1250-1000V1000M-1500-1000V1000'/><text x='75' y='-1320'>sin(-<tspan>k·s</tspan>)</text><path d='M0 1425V-1425'/><text x='1175' y='-75'><tspan>k</tspan></text><path d='M-3250 0H1250'/><circle r='18' cy='-1000'/><text x='45' y='-45'>0</text><circle r='18' cy='1000'/><path d='M-1000 866V0H0V866z'/><path d='M0 0C-61 128-413 1000-750 1000C-1087 1000-1439 128-1500 0'/><circle r='18' cx='-1000'/><circle r='18' cx='-750' cy='1000'/><circle r='18' cx='-750'/><circle r='18' cx='-1000'/><circle r='18' cy='866'/><circle r='18' cx='-1500'/><circle r='25'/><circle r='25' cx='-1000' cy='866'/><text x='45' y='904'>sin(<tspan>s</tspan>)</text><text x='45' y='1038'>-1</text><text x='45' y='-962'>1</text><text x='-1075' y='-45'>-1</text></svg>
              
            
!

CSS

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

JS

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

Console