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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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 h = 2000, w = 2*h;
- var x = -.5*w, y = -h;
- var r = .225*h;
- var nr = 16, a = Math.PI/nr;
- var asw = a*r;
- var sw = .004*h, fs = Math.round(.075*h);
- var na = Math.round(.05*fs);
- var rm = 2*r + fs;
- var x0 = Math.round(rm*Math.sin(a));
- var y0 = Math.round(rm*Math.cos(a));
- var x1 = Math.round(rm*Math.sin(2*a));
- var y1 = Math.round(rm*Math.cos(2*a));
- var x2 = Math.round(rm*Math.sin(4*a));
- var y2 = Math.round(rm*Math.cos(4*a));
- var x3 = Math.round(rm*Math.sin(6*a));
- var y3 = Math.round(rm*Math.cos(6*a));

svg(viewBox=[x, y, w, 1.5*h].join(' ') 
		xmlns='http://www.w3.org/2000/svg')
	style
		| * {
		| 	fill: #333;
		| 	font: #{Math.round(.84*fs)}px consolas, monaco, monospace
		| }
		| tspan { fill: #f90 }
		| #a { fill: #b53 }
		| #b { fill: #95a }
		| [d], [r] {
		| 	fill: none;
		| 	stroke: #333;
		| 	stroke-width: #{sw}
		| }
		| [x] + [d] { stroke: #ccc }
		| [r] {
		| 	stroke-width: #{2*r};
		| 	stroke-dasharray: #{asw.toFixed(2)}
		| }
		| [r] ~ [x] { fill: #ccc }
		| [r] + * * { font: #{Math.round(.84*fs)}px comic sans ms, cursive }
		| [r] ~ [d] { stroke: #f90; stroke-width: #{1.5*sw} }
		| #m { stroke: #b53 }
		| #n { stroke: #95a }
	text(x=x + .2*fs y=.75*y + fs) repeating-conic-gradient(#000 <tspan>0%</tspan> <tspan id='a'>$p/2</tspan>, transparent <tspan>0%</tspan> <tspan id='b'>$p</tspan>)
	text(x=(x + .2*fs) y=y + 3*fs) $p: 100%/$nr
	path(d=`M${x2}${-y2}L0 0L${x3}${-y3}`)
	path(d=`M0${-rm}V0L${x0}${-y0}M0 0L${x1}${-y1}`)
	circle(r=r)
	text(x=-1.3*fs y=y + fs)
		tspan ray start
		tspan#a(dy=fs) ray end
		tspan(dy=-fs) gap start
		tspan#b(dy=fs) gap end
	path(d=`M0${-rm}l${.7*fs}${-2*fs}m${.2*fs}${-.7*fs}l${-.4*fs}${-2.5*fs}m${7.5*fs} 0l${2.5*fs} ${2.5*fs}`)
	path#m(d=`M${x0}${-y0}l${1.5*fs}${-1.9*fs}m${.5*fs}${-.9*fs}l${.8*fs}${-1.5*fs}`)
	path#n(d=`M${x1}${-y1}l${.8*fs - x - x2}${-2.5*fs}m${.2*fs}${-.7*fs}l${-.5*fs}${-1.5*fs}`)
	text(x=x2 - 2*fs y=-(y2 + .6*fs)) repeat
	text(x=x3 - 1.2*fs y=-(y3 + fs)) repeat
	text(x=(x + .2*fs) y=y + 2*fs) // $nr: number of rays

// minimal SVG
<svg viewBox='-2000 -2000 4000 3000' xmlns='http://www.w3.org/2000/svg'><style>*{fill:#333;font:126px consolas,monaco,monospace}tspan{fill:#f90}#a{fill:#b53}#b{fill:#95a}[d],[r]{fill:none;stroke:#333;stroke-width:8}[x]+[d]{stroke:#ccc}[r]{stroke-width:900;stroke-dasharray:88.36}[r]~[x]{fill:#ccc}[r]+* *{font:126px comic sans ms,cursive}[r]~[d]{stroke:#f90;stroke-width:12}#m{stroke:#b53}#n{stroke:#95a}</style><text x='-1970' y='-1350'>repeating-conic-gradient(#000 <tspan>0%</tspan> <tspan id='a'>$p/2</tspan>, transparent <tspan>0%</tspan> <tspan id='b'>$p</tspan>)</text><text x='-1970' y='-1550'>$p: 100%/$nr</text><path d='M742-742L0 0L970-402'/><path d='M0-1050V0L205-1030M0 0L402-970'/><circle r='450'/><text x='-195' y='-1850'><tspan>ray start</tspan> <tspan id='a' dy='150'>ray end</tspan> <tspan dy='-150'>gap start</tspan> <tspan id='b' dy='150'>gap end</tspan></text><path d='M0-1050l105-300m30-105l-60-375m1125 0l375 375'/><path id='m' d='M205-1030l225-285m75-135l120-225'/><path id='n' d='M402-970l1378-375m30-105l-75-225'/><text x='442' y='-832'>repeat</text><text x='790' y='-552'>repeat</text><text x='-1970' y='-1700'>// $nr: number of rays</text></svg>
              
            
!

CSS

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

JS

              
                
              
            
!
999px

Console