123

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              - var vb_u = 2000, k = .05;
- var vb_h = 1.5*vb_u, vb_w = 2.5*vb_u;
- var pr = Math.round(.1*k*vb_w), na = Math.round(2*pr);
- var vb_x = -.5*(vb_w - vb_u);
- var vb_y = -.5*(vb_h + vb_u);
- var ax_xp = k*vb_w, ax_yp = k*vb_h;
- var ax_x0 = vb_x + ax_xp, ax_x1 = .5*(vb_w + vb_u) - ax_xp;
- var ax_y0 = .5*(vb_h - vb_u) - ax_yp, ax_y1 = vb_y + ax_xp;
- var fs = Math.round(3*na), n = 4, gu = vb_u/n;
- var m = 180, ba = Math.PI/m, bu = vb_u/m;
- var cp1 = .59*.5*vb_u, cp2 = vb_u - cp1;
- var dcp = .17*.5*vb_u, pr1 = Math.round(5*pr/7);
- var cp3 = .5*vb_u - dcp, cp4 = .5*vb_u + dcp;

svg(viewBox=[vb_x, vb_y, vb_w, vb_h].join(' ')
		 xmlns='http://www.w3.org/2000/svg')
	style
		| [d], [r] {
		|   fill: none;
		| 	stroke: #ccc;
		|   vector-effect: non-scaling-stroke
		| }
		| [x] {
		|   font: #{fs}px consolas, monaco, monospace;
		|   letter-spacing: #{-fs/5}
		| }
		| #e [d] { fill: #333; stroke: none }
		| [x] + [d], [r] {
		| 	stroke-width: 2;
		|   stroke: #333;
		|   marker-end: url(#e)
		| }
		| [d] + [x], tspan { font-style: italic }
		| [r] ~ [d] {
		| 	stroke: #a57;
		|		stroke-width: 4
		| }
		| [r] ~ [d] + [d] {
		| 	opacity: .7;
		|		stroke: #e83;
		| 	stroke-dasharray: 8
		| }
		| [r] { fill: #e83 }
		| @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')
	text(x=.5*fs y=(.7*fs + ax_y1)) (sin((<tspan>k</tspan>-½)·π)+1)·½
	path(d=`M0 ${ax_y0}V${ax_y1}`)
	text(x=(ax_x1 - .5*fs) y=-.5*fs) k
	path(d=`M${ax_x0} 0H${ax_x1}`)
	
	- var gd = [];
	- for(var i = 1; i <= n; i++) {
		- var cg = i*gu;
		- gd.push(`M${cg} ${-vb_u}V0`);
		- gd.push(`M${vb_u} ${-cg}H0`);
	- }
	path(d=gd.join(''))
	
	circle(r=pr1 cx=.5*vb_u)
	circle(r=pr1 cy=-.5*vb_u)
	circle(r=pr1 cx=vb_u)
	circle(r=pr1 cy=-vb_u)
	
	- var gd = [];
	- for(var i = 0; i <= m; i++) {
		- var x = Math.round(i*bu);
		- var y = -Math.round(.5*(1 - Math.cos(i*ba))*vb_u);
		- gd.push([x, y]);
	- }
	path(d=`M${gd.join(' ')}`)
	
	path(d=`M0 0C${.42*vb_u} 0 ${.58*vb_u}${-vb_u} ${vb_u}${-vb_u}`)
	
	circle(r=pr)
	circle(r=pr cx=vb_u cy=-vb_u)
	
	text(x=-.7*fs y=.9*fs) 0
	text(x=.5*(vb_u - fs) y=.9*fs) .5
	text(x=(vb_u - .3*fs) y=.9*fs) 1
	text(x=-1.3*fs y=.3*fs - .5*vb_u) .5
	text(x=-.7*fs y=.3*fs - vb_u) 1

// minimal SVG
<svg viewBox='-1500 -2500 5000 3000' xmlns='http://www.w3.org/2000/svg'><style>[d],[r]{fill:none;stroke:#ccc;vector-effect:non-scaling-stroke}[x]{font:150px consolas,monaco,monospace;letter-spacing:-30}#e [d]{fill:#333;stroke:none}[x]+[d],[r]{stroke-width:2;stroke:#333;marker-end:url(#e)}[d]+[x],tspan{font-style:italic}[r]~[d]{stroke:#a57;stroke-width:4}[r]~[d]+[d]{opacity:.7;stroke:#e83;stroke-dasharray:8}[r]{fill:#e83}@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><text x='75' y='-2145'>(sin((<tspan>k</tspan>-½)·π)+1)·½</text><path d='M0 350V-2250'/><text x='3175' y='-75'>k</text><path d='M-1250 0H3250'/><path d='M500-2000V0M2000-500H0M1000-2000V0M2000-1000H0M1500-2000V0M2000-1500H0M2000-2000V0M2000-2000H0'/><circle r='18' cx='1000'/><circle r='18' cy='-1000'/><circle r='18' cx='2000'/><circle r='18' cy='-2000'/><path d='M0,0 11,0 22-1 33-1 44-2 56-4 67-5 78-7 89-10 100-12 111-15 122-18 133-22 144-26 156-30 167-34 178-39 189-44 200-49 211-54 222-60 233-66 244-73 256-79 267-86 278-94 289-101 300-109 311-117 322-125 333-134 344-143 356-152 367-161 378-171 389-181 400-191 411-201 422-212 433-223 444-234 456-245 467-257 478-269 489-281 500-293 511-305 522-318 533-331 544-344 556-357 567-371 578-384 589-398 600-412 611-426 622-441 633-455 644-470 656-485 667-500 678-515 689-531 700-546 711-562 722-577 733-593 744-609 756-625 767-642 778-658 789-674 800-691 811-708 822-724 833-741 844-758 856-775 867-792 878-809 889-826 900-844 911-861 922-878 933-895 944-913 956-930 967-948 978-965 989-983 1000-1000 1011-1017 1022-1035 1033-1052 1044-1070 1056-1087 1067-1105 1078-1122 1089-1139 1100-1156 1111-1174 1122-1191 1133-1208 1144-1225 1156-1242 1167-1259 1178-1276 1189-1292 1200-1309 1211-1326 1222-1342 1233-1358 1244-1375 1256-1391 1267-1407 1278-1423 1289-1438 1300-1454 1311-1469 1322-1485 1333-1500 1344-1515 1356-1530 1367-1545 1378-1559 1389-1574 1400-1588 1411-1602 1422-1616 1433-1629 1444-1643 1456-1656 1467-1669 1478-1682 1489-1695 1500-1707 1511-1719 1522-1731 1533-1743 1544-1755 1556-1766 1567-1777 1578-1788 1589-1799 1600-1809 1611-1819 1622-1829 1633-1839 1644-1848 1656-1857 1667-1866 1678-1875 1689-1883 1700-1891 1711-1899 1722-1906 1733-1914 1744-1921 1756-1927 1767-1934 1778-1940 1789-1946 1800-1951 1811-1956 1822-1961 1833-1966 1844-1970 1856-1974 1867-1978 1878-1982 1889-1985 1900-1988 1911-1990 1922-1993 1933-1995 1944-1996 1956-1998 1967-1999 1978-1999 1989-2000 2000-2000'/><path d='M0 0C840 0 1160-2000 2000-2000'/><circle r='25'/><circle r='25' cx='2000' cy='-2000'/><text x='-105' y='135'>0</text><text x='925' y='135'>.5</text><text x='1955' y='135'>1</text><text x='-195' y='-955'>.5</text><text x='-105' y='-1955'>1</text></svg>
            
          
!
            
              body {
	display: flex;
	flex-direction: column;
	margin: 0;
	height: 100vh;
}
            
          
!
            
              // minimal SVG https://codepen.io/thebabydino/pen/gxxQOX
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console