cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              [[[https://codepen.io/thebabydino/pen/zEbVPO]]]

- var k = .05;
- var ax = (.5*(1 - .35*k)*d);
- var ra = .25*srco;
- var m0, m1, vt = [];

svg(viewBox=[-.5*d, -.5*d, 2*d, d].join(' ')
		xmlns='http://www.w3.org/2000/svg'
		 xmlns:xlink='http://www.w3.org/1999/xlink')
	style
		| svg { font: #{fs}px consolas, monaco, monospace }
		| [d], [r], line { fill: none; stroke: #{darken}; stroke-width: #{2*sw} }
		| #e * { fill: #{darken}; stroke: none }
		| [id] [d] { marker-end: url(#e) }
		| [d] + text { font: 1em times new roman, serif }
		| #u [r] { stroke: #{llight} }
		| g ~ [d] { stroke: #{orange}; stroke-width: #{3*sw} }
		| g + [d] { fill: rgba(255, 238, 51, .7) }
		| use ~ [d] { stroke: #{purple} }
		| #e + [d] { stroke: #777 }
		| [d] + [d] { stroke: #{tomato}; stroke-width: #{4*sw} }
		| #v [r] { fill: #{orange} }
		| [r] ~ [x] { font-style: italic }
		| tspan { font-size: .5em }
	- for(var i = 0; i < sp; i++) {
		- var ca = i*sbac;
		- vt.push([Math.cos(ca), Math.sin(ca)]);
		- svo.push([+(d + srco*vt[i][0]).toFixed(e), +(srco*vt[i][1]).toFixed(e)]);
		- svi.push([+(srco*Math.cos(2*ca)).toFixed(e), +(srco*Math.sin(2*ca)).toFixed(e)]);
	- }
	marker#e(markerWidth=ad markerHeight=ad 
						viewBox='0 -4 8 8' 
						orient='auto' refX='7')
		path(d='M8 0 0-4V4')
	path(d=`M${svo.slice(1).join(' ')} ${svo[0]}
					M${svi.slice(1).join(' ')} ${svi[0]}`)
	g#u
		circle(r=srco)
		text(x=+(-.75*fs).toFixed(e) y=-.2*fs) O
		path(d=`M${+(-ax).toFixed(e)} 0H${+(ax).toFixed(e)}`)
		text(x=ax - .5*fs y=-.5*fs) x
		path(d=`M0${+(-ax).toFixed(e)}V${+(ax).toFixed(e)}`)
		text(x=.4*fs y=(ax - .2*fs).toFixed(e)) y
		line(x2=r)
		text(x=srco y=-.2*fs) V<tspan>0</tspan>
	path(d=`M${d} 0 ${d + ra} 0
					A${ra} ${ra} 0 0 1 ${+(d + ra*cosc).toFixed(e)} ${+(ra*sinc).toFixed(e)}
					M0 0 ${ra} 0
					A${ra} ${ra} 0 0 1 ${+(ra*coss).toFixed(e)} ${+(ra*sins).toFixed(e)}`)
	use(xlink:href='#u' x=d)
	path(d=`M${d + srco} 0H${d}L${svo[1]}M${srco} 0H0L${svi[1]}`)
	path(d=`M${svo.slice(0, 2).join(' ')}
					M${svi.slice(0, 2).join(' ')}`)
	g#v
		text(x=(svo[0][0]).toFixed(e) y=(.9*fs).toFixed(e)) 0°
		text(x=(svo[1][0] - .5*fs).toFixed(e) y=(svo[1][1] + fs).toFixed(e)) 72°
		text(x=(svo[2][0] - 2.25*fs).toFixed(e) y=(svo[2][1] + .875*fs).toFixed(e)) 144°
		text(x=(svo[3][0] - 2*fs).toFixed(e) y=(svo[3][1] - .25*fs).toFixed(e)) 216°
		text(x=(svo[4][0] - .75*fs).toFixed(e) y=(svo[4][1] - .375*fs).toFixed(e)) 288°
		- for(var i = 0; i < sp; i++) {
			circle(cx=svo[i][0] cy=svo[i][1] r=pr)
		- }
		circle(cx=d r=pr1)
	use(xlink:href='#v' x=-d)

// minimal SVG
<svg viewBox='-1250 -1250 5000 2500' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><style>svg{font:150px consolas,monaco,monospace}[d],[r],line{fill:none;stroke:#333;stroke-width:10}#e *{fill:#333;stroke:none}[id] [d]{marker-end:url(#e)}[d]+text{font:1em times new roman,serif}#u [r]{stroke:#ccc}g~[d]{stroke:#f90;stroke-width:15}g+[d]{fill:rgba(255,238,51,.7)}use~[d]{stroke:#95a}#e+[d]{stroke:#777}[d]+[d]{stroke:#b53;stroke-width:20}#v [r]{fill:#f90}[r]~[x]{font-style:italic}tspan{font-size:.5em}</style><marker id='e' markerWidth='10' markerHeight='10' viewBox='0 -4 8 8' orient='auto' refX='7'><path d='M8 0 0-4V4'/></marker><path d='M2809 951 1691 588 1691-588 2809-951 3500 0M-809 588 309-951 309 951-809-588 1000 0'/><g id='u'><circle r='1000'/><text x='-113' y='-30'>O</text><path d='M-1228 0H1228'/><text x='1153.125' y='-75'>x</text><path d='M0-1228V1228'/><text x='60' y='1198'>y</text><line></line><text x='1000' y='-30'>V<tspan>0</tspan></text></g><path d='M2500 0 2750 0A250 250 0 0 1 2577 238M0 0 250 0A250 250 0 0 1-202 147'/><use xlink:href='#u' x='2500'/><path d='M3500 0H2500L2809 951M1000 0H0L-809 588'/><path d='M3500 0 2809 951M1000 0-809 588'/><g id='v'><text x='3500' y='135'>0°</text><text x='2734' y='1101'>72°</text><text x='1354' y='719'>144°</text><text x='1391' y='-626'>216°</text><text x='2697' y='-1007'>288°</text><circle cx='3500' cy='0' r='25'/><circle cx='2809' cy='951' r='25'/><circle cx='1691' cy='588' r='25'/><circle cx='1691' cy='-588' r='25'/><circle cx='2809' cy='-951' r='25'/><circle cx='2500' r='18'/></g><use xlink:href='#v' x='-2500'/></svg>
            
          
!
            
              body {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	margin: 0;
	height: 100vh;
}

svg { display: block }
            
          
!
            
              //minimal SVG: https://codepen.io/thebabydino/pen/EwpZXd?editors=1000
            
          
!
999px
Loading ..................

Console