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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

HTML

              
                <div id="clockapp">
	<canvas id="noise"></canvas>
	<canvas id="light"></canvas>
	<div id="tint"></div>
	<div id="clock">
		<div id="frontstage"></div>
		<div id="backstage"></div>
	</div>
	<div id="background"></div>
</div>
              
            
!

CSS

              
                


html, body { width: 100%; height: 100%; }
html, body, div, canvas { padding: 0; margin: 0; border: 0; }
body { overflow: hidden; }

#clockapp { 
	position: relative;
	width: 100%; height: 100%; 
	max-width: 100%; max-height: 100%;
	box-sizing: border-box;
	line-height: 0;
	/* font-size: 350px;
	font-family: 'wec'; */
}

#background {
	position: absolute; left: 0; top: 0;
}

#clock {
	position: absolute; left: 50%; top: 50%; 
	overflow: hidden;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	box-sizing: border-box;
	/* background-color: rgb(35, 35, 35); */
  	box-shadow: 5.5px 9.526px 39.56px 3.44px rgba(0, 0, 0, 0.20),21px 36.373px 90px 0px rgba(0, 0, 0, 0.30);
	z-index: 10;
}

#backstage { 
	
	width: 80%; height: 80%;
	background: conic-gradient(#eae182 42%, #f23f97);
	border-radius: 50%;
	position: absolute; top: 50%; left: 50%;
	transform: translate(-50%, -50%);
	overflow: hidden;
	z-index: 10;
}

#frontstage {
	position: absolute; top: 0; left: 0;
	z-index: 20; 
}

#tint {
	background-color: rgba(255,255,255,0.01);
	width: 100%; height: 100%;
	position: absolute;
	z-index: 20;
}


#light, #noise {
	position: absolute; left: 0; top: 0; 
	background-color: transparent;
}

#light { z-index: 30; }
#noise {
	opacity: 0.16; mix-blend-mode: soft-light;
	z-index: 40; 
}



              
            
!

JS

              
                



;(function (w,d)
{

	var size = 460,
		primaryBackground = '#81c6ea',
		secondaryBackground = '#ea82b5';
		facerigBackground = '#232323';


	var containerEl = d.getElementById('clockapp'),
		clockEl = d.getElementById('clock'),

		radius = size * 0.5,

		cw = containerEl.clientWidth,
		ch = containerEl.clientHeight,
		cx = cw * 0.5,
		cy = ch * 0.5,

		date = { ms: 0, s: 0, m: 0, h: 0 };



	// Clock
	// ---------------------------------------------------

	var Clock = function ()
	{
		// initialize
		clockEl.style.width = size + 'px';
		clockEl.style.height = size + 'px';
		clockEl.style.backgroundColor = facerigBackground;

		this.frontstage = new ClockFrontstage();
		this.backstage = new ClockBackstage();
		this.background = new ClockBackground();
		this.noise = new ClockNoise();
		this.light = new ClockLight();


		// 
		this.onResize = _.throttle(_.bind(function (e) 
		{
			cw = containerEl.clientWidth;
			ch = containerEl.clientHeight;
			cx = cw * 0.5;
			cy = ch * 0.5;

			this.background.resize();
			this.noise.update();
			this.light.update();

		}, this), 100);

		this.tick = _.throttle(_.bind(function (e) 
		{
			var date = new Date(),
				ms = date.getMilliseconds(),
				s = date.getSeconds(),
				m = date.getMinutes(),
				h = date.getHours();
				h = h >= 12 ? h - 12 : h;

			//var secdeg = toDeg((s + ms / 1000) * Math.PI / 30);
			var secdeg = toDeg(s * Math.PI / 30);
			var mindeg = toDeg((m + s / 60) * Math.PI / 30);
			
			this.frontstage.min.rotate(mindeg,0,0);
			//this.frontstage.minShd.rotate(mindeg,0,0);
			this.frontstage.sec.rotate(secdeg,0,0);
			//this.frontstage.secShd.rotate(secdeg,0,0);
			this.frontstage.setHour(h);

			this.backstage.el.style.transform = 'translate(-50%,-50%) rotate('+secdeg+'deg)';

			window.requestAnimationFrame(this.tick);

		}, this), 1000);

		
		$(w).on('resize.appclock', this.onResize);

		this.tick();
	};


	// Clock Frontstage
	// ---------------------------------------------------

	var ClockFrontstage = function ()
	{
		var draw = SVG('frontstage').size(460, 460);

		var gradient = draw.gradient('radial', function(stop) {
		  stop.at({ offset: 0, color: '#000000', opacity: 1.0 });
		  stop.at({ offset: 0.9, color: '#050505', opacity: 1.0 });
		  stop.at({ offset: 1, color: '#000000', opacity: 1.0 });
		});

		var ellipse = draw.circle(440, 440).fill({ color: '#fff' }).move(10,10);

		var fontStyle = { family: 'wec', size: 350 };

		//var t1 = draw.text('1').move(206, -120).font(fontStyle).attr({display:'none'});
		var p1 = draw.path('M216.3,313.4V179.4l-24.8,25.2c-3,3-6.3,4.6-9.8,4.6c-4,0-7.4-1.5-10.1-4.4c-2.8-2.9-4.2-6.4-4.2-10.3c0-3.3,1.4-6.5,4.2-9.8l49-48.6c3-3,6.2-4.6,9.4-4.6c4,0,7.3,1.8,10.2,5.2c2.8,3.5,4.2,7.4,4.2,11.6v165.2c0,4-1.3,7.3-4,10c-2.7,2.7-6,4-10,4c-4,0-7.3-1.3-10-4C217.6,320.7,216.3,317.4,216.3,313.4z');
		var p2 = draw.path('M186.3,150.3c5.6-5.8,12.2-10.4,19.8-13.6c7.6-3.3,15.8-4.9,24.7-4.9c8.6,0,16.8,1.6,24.5,4.9c7.7,3.3,14.4,7.8,20.1,13.5c5.7,5.7,10.2,12.4,13.5,20.1c3.3,7.7,4.9,15.9,4.9,24.5c0,8.6-1.6,16.8-4.9,24.5c-3.3,7.7-7.8,14.4-13.5,20.1c-5.7,5.7-12.4,10.2-20.1,13.5c-7.7,3.3-15.9,4.9-24.5,4.9c-9.8,0-18.1,3.4-24.9,10.2c-6.8,6.8-10.1,15-10.1,24.8v7h70c4,0,7.3,1.3,10,4c2.7,2.7,4,6,4,10c0,4-1.3,7.3-4,10c-2.7,2.7-6,4-10,4h-84c-4,0-7.3-1.3-10-4c-2.7-2.7-4-6-4-10v-21c0-8.6,1.6-16.8,4.9-24.5c3.3-7.7,7.8-14.4,13.5-20.1c5.7-5.7,12.4-10.2,20.1-13.5c7.7-3.3,15.9-4.9,24.5-4.9c9.8,0,18.1-3.4,24.8-10.1c6.8-6.8,10.2-15.1,10.2-24.9s-3.4-18.1-10.2-24.9c-6.8-6.8-15-10.1-24.8-10.1c-9.8,0-18.1,3.4-24.9,10.1c-2.8,2.8-6.1,4.2-9.8,4.2c-1.9,0-3.7-0.4-5.4-1.1c-1.8-0.7-3.2-1.8-4.4-3.1c-1.4-1.2-2.4-2.6-3.1-4.4c-0.7-1.8-1-3.6-1-5.4C182.1,156.4,183.5,153.1,186.3,150.3z');
		var p3 = draw.path('M223.6,201.8c6.1,0,11.1-2,15.1-6.1c4-4.1,6-9,6-14.9c0-5.8-2-10.8-6-14.9c-4-4.1-9-6.1-15.1-6.1c-1.2,0-2.9,0.2-5.2,0.7c-3.7,1.2-7.2,0.8-10.5-1.2c-3.3-2-5.5-4.8-6.6-8.6c-1.2-4-0.8-7.5,1.2-10.7c2-3.1,4.8-5.3,8.6-6.5c4.7-1.2,8.9-1.8,12.6-1.8c6.8,0,13.1,1.3,19.1,3.9c6,2.6,11.1,6.1,15.6,10.5c4.4,4.4,7.9,9.6,10.5,15.6c2.6,6,3.9,12.3,3.9,19.1c0,12.8-4.1,23.7-12.2,32.5c8.2,5.8,14.6,13.2,19.2,22.2c4.7,9,7,18.7,7,29.2c0,8.6-1.6,16.8-4.9,24.5c-3.3,7.7-7.8,14.4-13.5,20.1c-5.7,5.7-12.4,10.2-20.1,13.5c-7.7,3.3-15.9,4.9-24.5,4.9c-8.6,0-16.7-1.6-24.3-4.9c-7.6-3.3-14.3-7.8-20.1-13.6c-2.6-2.6-3.9-5.8-3.9-9.8c0-4,1.3-7.2,3.9-9.8c2.8-2.8,6.1-4.2,10-4.2c3.9,0,7.2,1.4,10,4.2c3.3,3.3,7,5.8,11.2,7.5c4.2,1.8,8.6,2.6,13.3,2.6c4.9,0,9.4-0.9,13.6-2.8c4.2-1.9,7.9-4.4,11-7.5c3.1-3.1,5.7-6.8,7.5-11c1.9-4.2,2.8-8.8,2.8-13.7s-0.9-9.5-2.8-13.7c-1.9-4.2-4.4-7.9-7.5-11c-3.2-3.2-6.8-5.7-11-7.5c-4.2-1.9-8.8-2.8-13.6-2.8c-4,0-7.3-1.3-10-4c-2.7-2.7-4-6-4-10c0-4,1.3-7.3,4-10C216.3,203.1,219.6,201.8,223.6,201.8z');
		var p4 = draw.path('M171,264.8l72.8-126c1.9-3.3,4.7-5.4,8.6-6.5c3.8-1,7.4-0.6,10.7,1.2c3.3,1.9,5.4,4.7,6.3,8.6c0.9,3.8,0.5,7.4-1.4,10.7l-60.5,105h31.9v-14c0-4,1.3-7.3,4-10c2.7-2.7,6-4,10-4c4,0,7.3,1.3,10,4c2.7,2.7,4,6,4,10v14h7c4,0,7.3,1.3,10,4c2.7,2.7,4,6,4,10c0,4-1.3,7.3-4,10c-2.7,2.7-6,4-10,4h-7v28c0,4-1.3,7.3-4,10c-2.7,2.7-6,4-10,4c-4,0-7.3-1.3-10-4c-2.7-2.7-4-6-4-10v-28h-56c-2.3,0-4.7-0.6-7-1.8c-2.3-1.2-4.1-2.9-5.2-5.1c-1.2-2.2-1.8-4.6-1.8-7.2C169.3,269,169.9,266.6,171,264.8z');
		var p5 = draw.path('M179.2,309.2c-2.6-2.6-3.9-5.8-3.9-9.8c0-4,1.3-7.2,3.9-9.8c2.8-2.8,6.1-4.2,10-4.2c3.9,0,7.2,1.4,10,4.2c3.3,3.3,7,5.8,11.2,7.5c4.2,1.8,8.6,2.6,13.3,2.6c4.9,0,9.4-0.9,13.6-2.8c4.2-1.9,7.9-4.4,11-7.5c3.1-3.1,5.7-6.8,7.5-11c1.9-4.2,2.8-8.8,2.8-13.7s-0.9-9.5-2.8-13.7c-1.9-4.2-4.4-7.9-7.5-11c-3.2-3.2-6.8-5.7-11-7.5c-4.2-1.9-8.8-2.8-13.6-2.8H203c-4,0-7.4-1.3-10.1-4c-2.8-2.7-4.2-6-4.2-10v-70c0-4,1.3-7.3,4-10c2.7-2.7,6-4,10-4h56c4,0,7.3,1.3,10,4c2.7,2.7,4,6,4,10c0,4-1.3,7.3-4,10c-2.7,2.7-6,4-10,4h-42v42h7c8.6,0,16.8,1.6,24.5,4.9c7.7,3.3,14.4,7.8,20.1,13.5c5.7,5.7,10.2,12.4,13.5,20.1c3.3,7.7,4.9,15.9,4.9,24.5c0,8.6-1.6,16.8-4.9,24.5c-3.3,7.7-7.8,14.4-13.5,20.1c-5.7,5.7-12.4,10.2-20.1,13.5c-7.7,3.3-15.9,4.9-24.5,4.9c-8.6,0-16.7-1.6-24.3-4.9C191.7,319.6,185,315,179.2,309.2z');
		var p6 = draw.path('M254.9,152.8l-28.4,49h3.5c11.2,0,21.9,2.8,32.2,8.4c10.3,6.1,18.1,13.9,23.5,23.6c5.4,9.7,8,20,8,31c0,5.4-0.7,10.7-2.1,16.1c-1.4,5.4-3.5,10.5-6.3,15.4c-6.1,10.3-13.9,18.1-23.6,23.5c-9.7,5.4-20,8-31,8c-5.4,0-10.7-0.7-16.1-2.1c-5.4-1.4-10.5-3.5-15.4-6.3c-10.3-6.1-18.1-13.9-23.5-23.6c-5.4-9.7-8-20-8-31c0-5.4,0.7-10.7,2.1-16.1c1.4-5.4,3.5-10.5,6.3-15.4l54.6-94.5c1.2-2.3,2.9-4.1,5.1-5.2c2.2-1.2,4.6-1.8,7.2-1.8c2.8,0,5.1,0.6,7,1.8c2.3,1.2,4,2.9,5.1,5.1c1,2.2,1.6,4.6,1.6,7.2C256.7,148.8,256.1,151.1,254.9,152.8z M200.3,247.2c-3,5.4-4.5,11.2-4.5,17.5c0,6.1,1.5,11.8,4.5,17.3c3,5.5,7.4,9.9,13,13.1c5.4,3,11.2,4.5,17.5,4.5c6.1,0,11.8-1.5,17.3-4.5c5.5-3,9.9-7.4,13.1-13c3-5.4,4.5-11.2,4.5-17.5c0-6.1-1.5-11.8-4.5-17.3c-3-5.5-7.4-9.9-13-13.1c-5.4-3-11.2-4.5-17.5-4.5c-6.1,0-11.8,1.5-17.3,4.5C208,237.3,203.6,241.7,200.3,247.2z');
		var p7 = draw.path('M217.8,313.8c0,4-1.3,7.3-4,10c-2.7,2.7-6,4-10,4c-4,0-7.3-1.3-10-4c-2.7-2.7-4-6-4-10v-98c0-5.8,1.1-11.3,3.3-16.3c2.2-5,5.2-9.5,9.1-13.3c3.9-3.8,8.3-6.9,13.3-9.1c5-2.2,10.4-3.3,16.3-3.3c5.4,0,10.1-1.3,14.2-3.9c4.1-2.6,7.4-5.9,10-10.1h-52.2c-4,0-7.3-1.3-10-4c-2.7-2.7-4-6-4-10c0-4,1.3-7.3,4-10c2.7-2.7,6-4,10-4h70c4,0,7.3,1.3,10,4c2.7,2.7,4,6,4,10c0,7.7-1.5,14.9-4.4,21.7c-2.9,6.8-6.9,12.7-12.1,17.8c-5.1,5.1-11.1,9.2-17.8,12.1c-6.8,2.9-14,4.4-21.7,4.4c-4,0-7.3,1.3-10,4c-2.7,2.7-4,6-4,10V313.8z');
		var p8 = draw.path('M167.8,264.8c0-10.5,2.4-20.2,7.2-29.2c4.8-9,11.3-16.4,19.4-22.2c-8.4-8.9-12.6-19.7-12.6-32.5c0-6.8,1.3-13.1,3.9-19.1c2.6-5.9,6.1-11.1,10.5-15.6c4.4-4.4,9.6-7.9,15.6-10.5c6-2.6,12.3-3.9,19.1-3.9c6.8,0,13.1,1.3,19.1,3.9c5.9,2.6,11.1,6.1,15.6,10.5c4.4,4.4,7.9,9.6,10.5,15.6c2.6,6,3.8,12.3,3.8,19.1c0,6.3-1.1,12.2-3.3,17.9c-2.2,5.6-5.3,10.5-9.3,14.7c8.2,5.8,14.6,13.2,19.4,22.2c4.8,9,7.2,18.7,7.2,29.2c0,8.6-1.6,16.8-4.9,24.5c-3.3,7.7-7.8,14.4-13.5,20.1c-5.7,5.7-12.4,10.2-20.1,13.5c-7.7,3.3-15.9,4.9-24.5,4.9c-8.6,0-16.8-1.6-24.5-4.9c-7.7-3.3-14.4-7.8-20.1-13.5c-5.7-5.7-10.2-12.4-13.5-20.1C169.4,281.5,167.8,273.4,167.8,264.8z M195.8,264.8c0,9.8,3.4,18.1,10.1,24.8c6.8,6.8,15.1,10.2,24.9,10.2c9.8,0,18.1-3.4,24.8-10.2c6.8-6.8,10.2-15,10.2-24.8s-3.4-18.1-10.2-24.8c-6.8-6.8-15-10.2-24.8-10.2c-9.8,0-18.1,3.4-24.9,10.2C199.2,246.7,195.8,255,195.8,264.8z M209.8,180.8c0,5.8,2,10.8,6.1,14.9c4.1,4.1,9,6.1,14.9,6.1c5.8,0,10.8-2,14.9-6.1c4.1-4.1,6.1-9,6.1-14.9c0-5.8-2-10.8-6.1-14.9c-4.1-4.1-9-6.1-14.9-6.1c-5.8,0-10.8,2-14.9,6.1C211.8,170,209.8,174.9,209.8,180.8z');
		var p9 = draw.path('M206.8,306.8l28.3-49h-3.5c-11.4,0-22.2-2.8-32.2-8.4c-10.3-6.1-18.1-13.9-23.5-23.6c-5.4-9.7-8-20-8-31c0-5.4,0.7-10.7,2.1-16.1c1.4-5.4,3.5-10.5,6.3-15.4c6.1-10.3,13.9-18.1,23.6-23.5c9.7-5.4,20-8,31-8c5.4,0,10.7,0.7,16.1,2.1c5.4,1.4,10.5,3.5,15.4,6.3c10.3,6.1,18.1,13.9,23.5,23.6c5.4,9.7,8,20,8,31c0,5.4-0.7,10.7-2.1,16.1c-1.4,5.4-3.5,10.5-6.3,15.4L231,320.8c-1.2,2.3-2.9,4.1-5.1,5.2c-2.2,1.2-4.6,1.8-7.2,1.8c-3,0-5.4-0.6-7-1.8c-2.3-1.2-4-2.9-5.1-5.1c-1-2.2-1.6-4.6-1.6-7.2C205.1,311,205.6,308.6,206.8,306.8z M261.4,212.2c3-5.4,4.5-11.2,4.5-17.5c0-6.1-1.5-11.8-4.5-17.3c-3-5.5-7.3-9.9-13-13.1c-5.4-3-11.2-4.5-17.5-4.5c-6.1,0-11.8,1.5-17.3,4.5c-5.5,3-9.9,7.4-13.1,13c-3,5.4-4.5,11.2-4.5,17.5c0,6.1,1.5,11.8,4.5,17.3c3,5.5,7.4,9.9,13,13.1c5.4,3,11.2,4.5,17.5,4.5c6.1,0,11.8-1.5,17.3-4.5C253.8,222.2,258.1,217.9,261.4,212.2z');
		var p10l = draw.path('M154.3,313.4V179.4l-24.9,25.2c-3,3-6.3,4.6-9.8,4.6c-4,0-7.4-1.5-10.1-4.4c-2.8-2.9-4.2-6.4-4.2-10.3c0-3.3,1.4-6.5,4.2-9.8l49-48.6c3-3,6.2-4.6,9.4-4.6c4,0,7.4,1.8,10.1,5.2c2.8,3.5,4.2,7.4,4.2,11.6v165.2c0,4-1.3,7.3-4,10c-2.7,2.7-6,4-10,4c-4,0-7.3-1.3-10-4C155.6,320.7,154.3,317.4,154.3,313.4z');
		var p10r = draw.path('M196.3,201.8c0-9.6,1.8-18.6,5.4-27.1c3.6-8.5,8.6-15.9,14.9-22.2c6.3-6.3,13.7-11.3,22.2-15c8.5-3.7,17.7-5.6,27.5-5.6c9.6,0,18.6,1.9,27.1,5.6c8.5,3.7,15.9,8.8,22.2,15c6.3,6.3,11.3,13.7,15.1,22.2c3.7,8.5,5.6,17.6,5.6,27.1v56c0,9.8-1.9,19-5.6,27.5c-3.7,8.5-8.8,15.9-15.1,22.2c-6.3,6.3-13.7,11.3-22.2,14.9c-8.5,3.6-17.6,5.4-27.1,5.4c-9.8,0-19-1.8-27.5-5.4c-8.5-3.6-15.9-8.6-22.2-14.9c-6.3-6.3-11.3-13.7-14.9-22.2c-3.6-8.5-5.4-17.7-5.4-27.5V201.8z M224.3,201.8v56c0,5.8,1.1,11.3,3.3,16.3c2.2,5,5.2,9.4,9.1,13.3c3.9,3.8,8.3,6.9,13.3,9.1c5,2.2,10.4,3.3,16.3,3.3c5.8,0,11.3-1.1,16.3-3.3c5-2.2,9.4-5.2,13.3-9.1c3.8-3.9,6.9-8.3,9.1-13.3c2.2-5,3.3-10.4,3.3-16.3v-56c0-5.8-1.1-11.3-3.3-16.3c-2.2-5-5.2-9.5-9.1-13.3c-3.9-3.8-8.3-6.9-13.3-9.1c-5-2.2-10.4-3.3-16.3-3.3c-5.8,0-11.3,1.1-16.3,3.3c-5,2.2-9.4,5.2-13.3,9.1c-3.8,3.9-6.9,8.3-9.1,13.3C225.4,190.5,224.3,195.9,224.3,201.8z');
		var p11l = draw.path('M171.8,313.4V179.4l-24.9,25.2c-3,3-6.3,4.6-9.8,4.6c-4,0-7.4-1.5-10.1-4.4c-2.8-2.9-4.2-6.4-4.2-10.3c0-3.3,1.4-6.5,4.2-9.8l49-48.6c3-3,6.2-4.6,9.4-4.6c4,0,7.4,1.8,10.1,5.2c2.8,3.5,4.2,7.4,4.2,11.6v165.2c0,4-1.3,7.3-4,10c-2.7,2.7-6,4-10,4c-4,0-7.3-1.3-10-4C173.1,320.7,171.8,317.4,171.8,313.4z');
		var p11r = draw.path('M262.8,313.4V179.4l-24.8,25.2c-3,3-6.3,4.6-9.8,4.6c-4,0-7.3-1.5-10.2-4.4c-2.8-2.9-4.2-6.4-4.2-10.3c0-3.3,1.4-6.5,4.2-9.8l49-48.6c3-3,6.2-4.6,9.5-4.6c4,0,7.3,1.8,10.1,5.2c2.8,3.5,4.2,7.4,4.2,11.6v165.2c0,4-1.3,7.3-4,10c-2.7,2.7-6,4-10,4c-4,0-7.3-1.3-10-4C264.1,320.7,262.8,317.4,262.8,313.4z');
		var p12l = draw.path('M158.3,313.4V179.4l-24.9,25.2c-3,3-6.3,4.6-9.8,4.6c-4,0-7.4-1.5-10.1-4.4c-2.8-2.9-4.2-6.4-4.2-10.3c0-3.3,1.4-6.5,4.2-9.8l49-48.6c3-3,6.2-4.6,9.4-4.6c4,0,7.4,1.8,10.1,5.2c2.8,3.5,4.2,7.4,4.2,11.6v165.2c0,4-1.3,7.3-4,10c-2.7,2.7-6,4-10,4c-4,0-7.3-1.3-10-4C159.6,320.7,158.3,317.4,158.3,313.4z');
		var p12r = draw.path('M218.8,150.3c5.6-5.8,12.2-10.4,19.8-13.6c7.6-3.3,15.8-4.9,24.7-4.9c8.6,0,16.8,1.6,24.5,4.9c7.7,3.3,14.4,7.8,20.1,13.5c5.7,5.7,10.2,12.4,13.5,20.1c3.3,7.7,4.9,15.9,4.9,24.5c0,8.6-1.6,16.8-4.9,24.5c-3.3,7.7-7.8,14.4-13.5,20.1c-5.7,5.7-12.4,10.2-20.1,13.5c-7.7,3.3-15.9,4.9-24.5,4.9c-9.8,0-18.1,3.4-24.8,10.2c-6.8,6.8-10.2,15-10.2,24.8v7h70c4,0,7.3,1.3,10,4c2.7,2.7,4,6,4,10c0,4-1.3,7.3-4,10c-2.7,2.7-6,4-10,4h-84c-4,0-7.3-1.3-10-4c-2.7-2.7-4-6-4-10v-21c0-8.6,1.6-16.8,4.9-24.5c3.3-7.7,7.8-14.4,13.5-20.1c5.7-5.7,12.4-10.2,20.1-13.5c7.7-3.3,15.9-4.9,24.5-4.9c9.8,0,18.1-3.4,24.8-10.1c6.8-6.8,10.2-15.1,10.2-24.9s-3.4-18.1-10.2-24.9c-6.8-6.8-15.1-10.1-24.8-10.1c-9.8,0-18.1,3.4-24.8,10.1c-2.8,2.8-6.1,4.2-9.8,4.2c-1.9,0-3.7-0.4-5.4-1.1c-1.8-0.7-3.2-1.8-4.4-3.1c-1.4-1.2-2.4-2.6-3.1-4.4c-0.7-1.8-1-3.6-1-5.4C214.6,156.4,216,153.1,218.8,150.3z');

		this.hours = [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10l,p10r,p11l,p11r,p12l,p12r];
		
		var mask = draw.mask().add(ellipse)
		.add(p1).add(p2).add(p3)
		.add(p4).add(p5).add(p6)
		.add(p7).add(p8).add(p9)
		.add(p10l).add(p10r).add(p11l).add(p11r).add(p12l).add(p12r);

		this.setHour = function (h)
		{
			if (!this.currentHour || this.currentHour != h) 
			{
				for (var i = 0; i < this.hours.length; i++) {
					this.hours[i].attr({ display:'none' });
				}

				if (h == 1) this.hours[0].attr({display:''});
				if (h == 2) this.hours[1].attr({display:''});
				if (h == 3) this.hours[2].attr({display:''});
				if (h == 4) this.hours[3].attr({display:''});
				if (h == 5) this.hours[4].attr({display:''});
				if (h == 6) this.hours[5].attr({display:''});
				if (h == 7) this.hours[6].attr({display:''});
				if (h == 8) this.hours[7].attr({display:''});
				if (h == 9) this.hours[8].attr({display:''});
				if (h == 10) {
					this.hours[9].attr({display:''});
					this.hours[10].attr({display:''});
				}
				if (h == 11) {
					this.hours[11].attr({display:''});
					this.hours[12].attr({display:''});
				}
				if (h == 0) {
					this.hours[13].attr({display:''});
					this.hours[14].attr({display:''});
				}

				this.currentHour = h;
			}
		};
		
		var rect = draw.circle(440, 440).fill({
			color:gradient, opacity: 1
		}).move(10,10);

		rect.maskWith(mask);


		// marks
		var marks = draw.group();
			marks.transform({ x:230, y:230 });

		var clock = draw.nested();
			clock.attr({ 'stroke-linecap':'round' });
			marks.add(clock);

		for (var i = 1; i <= 12; i++)
		{
			var radians = i * 30 * (Math.PI/180);
			
			var p2 = {
				x:(radius - 11)* Math.cos(radians), 
				y:(radius - 11)* Math.sin(radians)
			};
			
			var p1 = {
				x:(radius - 50)* Math.cos(radians), 
				y:(radius - 50)* Math.sin(radians)
			};
			
			clock.line(p1.x, p1.y, p2.x, p2.y).stroke({ width: 2, opacity: 0.15, color:'#fff' });
		}


		// hands
		var hands = draw.nested();
		var p1 = { x:0, y:27 };
		var p2 = { x:0, y:-204 };

		this.min = hands.line(p1.x, p1.y, p2.x, p2.y).stroke({ width: 10, color:'#181818' });
		//this.minShd = hands.image('http://alexkulagin.com/img/handMinShadow.png').move(-230, -230);
		this.sec = hands.line(p1.x, p1.y, p2.x, p2.y).stroke({ width: 10, color:'#ffffff' });
		//this.secShd = hands.image('http://alexkulagin.com/img/handSecShadow.png').move(-230, -230);

		var pin = hands.circle(6,6).translate(-3,-3).fill('#292929');

		hands.addTo(clock);
		//sec.rotate(270,0,0);

	};


	// Clock Backstage
	// ---------------------------------------------------

	var ClockBackstage = function ()
	{
		this.el = d.getElementById('backstage');
		this.el.style.width = size - 40 + 'px';
		this.el.style.height = size - 40 + 'px';
		//el.style.backgroundColor = '#eae182';
	};


	// Clock Noise
	// ---------------------------------------------------

	var ClockNoise = function ()
	{
		this.ctxN = document.getElementById('noise').getContext("2d");
		
		this.update = function ()
		{
			var cw = window.innerWidth,
				ch = window.innerHeight;
			
			this.ctxN.canvas.width = cw;
			this.ctxN.canvas.height = ch;
			this.ctxN.save();
			this.ctxN.clearRect(0, 0, cw, ch);

			// noise top ========================

			var idata = this.ctxN.createImageData(cw, ch),
				buffer32 = new Uint32Array(idata.data.buffer),
				len = buffer32.length,
				i = 0;

			for(i; i < len;) {
				buffer32[i++] = ((255 * Math.random())|0) << 24;
			}

			this.ctxN.putImageData(idata, 0, 0);
			this.ctxN.restore();
		};

		this.update();
	};


	// Clock Light
	// ---------------------------------------------------

	var ClockLight = function ()
	{
		this.ctxG = document.getElementById('light').getContext("2d");
		
		this.update = function ()
		{
			var cw = window.innerWidth,
				ch = window.innerHeight;
			
			this.ctxG.canvas.width = cw;
			this.ctxG.canvas.height = ch;
			this.ctxG.save();
			this.ctxG.clearRect(0, 0, cw, ch);

			// gradient top =====================

			var rg = this.ctxG.createRadialGradient(0, 0, ch * 1.5, 0, 0, 0);
			rg.addColorStop(0,'rgba(255,255,255,0)');
			rg.addColorStop(1,'rgba(255,255,255,0.16)');
			this.ctxG.fillStyle = rg;
			this.ctxG.fillRect(0, 0, cw, ch);

			// gradient bottom ==================

			var rg = this.ctxG.createRadialGradient(cw, ch, ch * 1.5, cw, ch, 0);
			rg.addColorStop(0,'rgba(255,255,255,0)');
			rg.addColorStop(1,'rgba(255,255,255,0.16)');
			this.ctxG.fillStyle = rg;
			this.ctxG.fillRect(0, 0, cw, ch);

			// restore ==========================
			
			this.ctxG.restore();
		};

		this.update();
	};


	// Clock Background
	// ---------------------------------------------------

	var ClockBackground = function ()
	{
		var el, draw;

		el = d.getElementById('background');
		el.style.width = '100%';
		el.style.height = '100%';
		el.style.backgroundColor = primaryBackground;

		draw = SVG('background').size('100%', '100%');
		

		this.resize = function ()
		{
			draw.clear()
			draw.polyline('0,0 ' + cw + ',0 0,' + ch + '').fill({ color: secondaryBackground });
		}


		this.resize();
	};


	// Utils
	// ---------------------------------------------------

	const TODEG = 180 / Math.PI,
		  TORAD = Math.PI / 180;

	function interpolate (p1, p2, f) {
		var x = f * p1.x + (1 - f) * p2.x, y = f * p1.y + (1 - f) * p2.y;
		return { x:x, y:y };
	}

	function toRad (deg) { return deg != 0 ? deg * TORAD : 0 };
	function toDeg (rad) { return rad != 0 ? rad * TODEG : 0 };
	function getRandomInt (min, max) { return (Math.floor(Math.random() * (max - min)) + min) };

	function trace () {
		var i = -1, l = arguments.length, args = [], fn = 'console.log(args)';
		while (++i < l) args.push('args['+i+']');
		(new Function('args', fn.replace(/args/, args.join(','))))(arguments);
	};



	// Instance
	// ---------------------------------------------------

	w['clockapp'] = new Clock();


})(window,document);
              
            
!
999px

Console