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 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

              
                
              
            
!

CSS

              
                body {
	background-color: rgb(254, 255, 253);
}

canvas {
	margin-left: calc(50% - 200px);
}
              
            
!

JS

              
                function setup(){
	//Set up HTML Canvas
	createCanvas(400,400);
	angleMode(DEGREES);
}

function draw(){
	
	//Set up rotation & bg color
	background(254, 255, 253);
	translate(200, 200);
	rotate(-90);
	
	//Set up time vars
	let hr = hour();
	let min = minute();
	let sec = second();
	
	//Default settings for time arcs
	noFill();
	strokeWeight(8);
	
	//Seconds arc
	let secAngle = map(sec, 0, 60, 0, 360);
	stroke(188, 206, 217);
	arc(0, 0, 300, 300, 0, secAngle);
	
	//minuets arc
	let minAngle = map(min, 0, 60, 0, 360);
	stroke(154, 181, 198);
	arc(0, 0, 280, 280, 0, minAngle);
	
	//Hours arc
	let hrAngle = map(hr % 12, 0, 12, 0, 360);
	stroke(71, 121, 152);
	arc(0, 0, 260, 260, 0, hrAngle);
	
	//seconds hand
	push();
	rotate(secAngle);
	strokeWeight(2);
	stroke(188, 206, 217);
	line(0, 0, 80, 0);
	pop();
	
	//Minuets hand
	push();
	rotate(minAngle);
	strokeWeight(4);
	stroke(154, 181, 198);
	line(0, 0, 80, 0);
	pop();
	
	//Hours hand
	push();
	rotate(hrAngle);
	strokeWeight(8);
	stroke(71, 121, 152);
	line(0, 0, 100, 0);
	pop();
	
	//Dot in the middle
	stroke(254, 255, 253);
  point(0, 0);
	
	
	//Settings for time text
	fill(154, 181, 198);
	noStroke();
	rotate(90);
	
	//Time text
	textAlign(CENTER, BOTTOM);
	text(nf(hr, 2) + ":" + nf(min, 2) + ":" + nf(sec, 2), 0, 190);
}
              
            
!
999px

Console