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 vb_w = 1600, vb_h = .5*vb_w, vb_x = -.58*vb_w, vb_y = -.3*vb_h;
- var line_xtra = .16*vb_w, half_xtra = .5*line_xtra, line_thck = .032*line_xtra, line_thin = .5*line_thck;
- var pt_r = 1.25*line_thck, f = 4, fs = .05*vb_w;
- var x2 = .25*vb_w, rect_crnr = (f + 1)*line_thck, xe = x2 + half_xtra;
- var rr = +(half_xtra*Math.sqrt(2)).toFixed(1);

section
	svg(viewBox=[vb_x, vb_y, vb_w, vb_h].join(' '))
		style svg { font: #{fs}px consolas; fill: #333; stroke-width: #{line_thin}px }
			| rect { fill: khaki }
			| [d], [d] + [r] { fill: none; stroke: grey }
			| g [d] { stroke-width: #{line_xtra}px; stroke: rgba(200, 200, 200, .5) }
			| [d] + [d], line { stroke-width: #{line_thck}px }
			| line { stroke: #e18728 }
			| [d] + [d] { stroke: #be4c39 }
		text(x=(fs + vb_x) y=fs) ▲
			tspan(dx=-1.5*fs dy=fs) TOP
			tspan(dx=-2.5*fs dy=fs) EDGE
		rect(x=vb_x y=vb_y width=vb_w height=-vb_y)
		path(d=`M${vb_x} 0H${-vb_x}M0${vb_y}V${vb_h}`)
		circle(r=rr)
		g#strip
			path(d=`M0-${half_xtra}V${xe}`)
			path(d=`M-${half_xtra}-${half_xtra} 0 0 ${half_xtra}-${half_xtra}`)
			line(y2=x2)
			circle(r=pt_r)
			circle(r=pt_r)
			circle(r=pt_r cy=x2)
			circle(r=pt_r cx=-half_xtra cy=-half_xtra)
			circle(r=pt_r cx=half_xtra cy=-half_xtra)
			text(x=.1*fs y=.8*fs) E
			text(x=(half_xtra + .2*fs) y=-(half_xtra + .1*fs)) A
			text(x=-(half_xtra + .6*fs) y=-(half_xtra + .1*fs)) B
	form
		input#angle(type='range' min='-90' max='90')
              
            
!

CSS

              
                $ctrl-hl: #e18728;
$ctrl-ll: #aaa;
$track-w: 14em;
$track-h: .25em;
$thumb-d: 1.25em;

body {
	display: flex;
	justify-content: center;
	align-items: center;
	margin: 0;
	height: 100vh;
}

section {
	position: relative;
	width: 100em; height: 50em;
	font-size: 2vh;
  
  @media (max-aspect-ratio: 10/7) { font-size: 1vw }
}

/* FORM */

@mixin track() {
	width: $track-w; height: $track-h;
	background: $ctrl-ll;
}

@mixin fill() { background: $ctrl-hl; }

@mixin thumb() {
	border: none;
	width: $thumb-d; height: $thumb-d;
	border-radius: 50%;
	background: $ctrl-hl;
}

form {
	position: absolute;
	top: 0; left: 0;
	padding: 0 .25em;
	background: rgba(#222, .9);
	text-align: center;
	font: 1rem trebuchet ms, sans-serif;
}

[type='range'] {
	border: solid 0 transparent;
	border-width: 0 1em;
	padding: 0;
	width: $track-w; height: $track-h + 2em;
	background: none;
	font-size: 1em;
	cursor: pointer;
	
	&, 
	&::-webkit-slider-runnable-track, 
	&::-webkit-slider-thumb {
		-webkit-appearance: none;
	}
	
	&::-webkit-slider-runnable-track {
		@include track();
	}
	&::-moz-range-track {
		@include track();
	}
	&::-ms-track {
		border: none;
		@include track();
		color: transparent;
	}
	
	&::-moz-range-progress {
		@include fill();
	}
	&::-ms-fill-lower {
		@include fill();
	}
	
	&::-webkit-slider-thumb {
		margin-top: .5*($track-h - $thumb-d);
		@include thumb();
	}
	&::-moz-range-thumb {
		@include thumb();
	}
	&::-ms-thumb {
		@include thumb();
	}
	
	&:focus {
		outline: solid 1px $ctrl-hl;
	}
	
	+ output { order: 0; }
}
              
            
!

JS

              
                const _STRIP = document.getElementById('strip'), 
			_ANGLE = document.getElementById('angle');

let curr_angle = 0;

function update(deg, flag) {
	curr_angle = deg;
	_STRIP.setAttribute(`transform`, `rotate(${deg})`);
	
	if(!flag) _ANGLE.value = deg;
};

function input() {
	if(curr_angle != _ANGLE.value) update(+_ANGLE.value, 1);
}

_ANGLE.addEventListener('input', input, false);
_ANGLE.addEventListener('change', input, false);
              
            
!
999px

Console