Pen Settings



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


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


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.


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.


                <div class="wrapper">
  <svg version="1.1" id="clock" xmlns="" xmlns:xlink="" x="0px" y="0px"
  viewBox="0 0 142 142" enable-background="new 0 0 142 142" xml:space="preserve">

    @import url(",300i,400,400i,600,700");
    text { font-family: 'Lato'; font-weight: 400; }

  <clipPath id="c1"><path d="M105.8,11C100.1,7.7,94,5.3,87.9,3.7c-0.5-0.2-0.9-0.3-1.3-0.3c-3.6-0.6-7.3,1.1-9.2,4.5
  c-18.1,33.1-5.9,75,27,93.4c32.8,18.3,74.2,6.9,93.1-25.7C150,72.1,138.8,30,105.8,11z" /></clipPath>
  <clipPath id="c2"><path d="M95.1,103.7c16.6-12,21.6-34.8,11.7-52.7c-4.3-7.8-10.8-13.6-18.2-17.2c-0.1,0-0.2-0.1-0.3-0.1
    c-1.2,0.6-2.4,1.3-3.6,2c-19.1,11.9-24.9,37-13,56.1C49,112.1,75.7,117.6,95.1,103.7z" /></clipPath>

    <text class="displayH f1" x="71" y="75" text-anchor="middle" style="font-size: 10px">00</text>
    <g id="handH">
      <ellipse class="f1" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -29.0876 71.0443)" cx="71.2" cy="70.6" rx="13.4" ry="13.3"/>
      <text id="handTextH" class="displayH f2" x="71" y="75" text-anchor="middle" style="font-size: 10px">00</text>

    <text class="displayM f1" x="103.5" y="75" text-anchor="middle" style="font-size: 10px">00</text>
    <g id="handM" clip-path="url(#c2)">
      <circle class="f1 circleM" cx="50%" cy="50%" r="71" />
      <text id="handTextM" class="displayM f2" x="103.5" y="75" text-anchor="middle" style="font-size: 10px">00</text>

    <text class="displayS f1" x="131.5" y="75" text-anchor="middle" style="font-size: 10px">00</text>
    <g id="handS" clip-path="url(#c1)">
      <circle class="f1 circleS" cx="50%" cy="50%" r="71" />
      <text id="handTextS" class="displayS f2" x="131.5" y="75" text-anchor="middle" style="font-size: 10px">00</text>


                $color-primary: #2cb397;
$color-secondary: #fff;

.wrapper {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 600px;
  color: $color-primary;
  padding: 10px;

.f1 {
  fill: $color-primary;

.f2 {
  fill: $color-secondary;



                var last = new Date();
var lastSecond = 0;
var delta = 0;

function lerp(o,t,p) { return o + (t-o) * p; }

var sDeg = 0;
function seconds(s,ms) {

  var target = s/60 * 360;
  if (target===0 && sDeg > 300) { sDeg = -6; } // Wrapping
  sDeg = lerp(sDeg,target,delta*24);

  hs.transform('R '+sDeg+',71,71');
  hts.transform('R '+(sDeg*-1)+',71,71');


var mDeg = 0;
function minutes(m,s) {
  var target = m/60 * 360;
  if (target===0 && mDeg > 300) { mDeg = -6; } // Wrapping
  mDeg = lerp(mDeg,target,delta*24);
  hm.transform('T0,0 R '+mDeg+',71,71');
  htm.transform('T0,0 R '+(mDeg*-1)+',71,71');

function hours(h,m) {
  var deg = (h+(m/60))/12 * 360;
  hh.transform('T0,0 R '+deg+',71,71');
  hth.transform('T0,0 R '+(deg*-1)+',71,71');

function updateTimes(s,m,h) {

  var i,
  elS = document.getElementsByClassName('displayS'),
  elM = document.getElementsByClassName('displayM'),
  elH = document.getElementsByClassName('displayH');

  function pad(num) {
    var str = num.toString();
    return str.length>1 ? str : '0'+str;

  for (i=0; i<elS.length; i++) { elS[i].innerHTML = pad(s); }
  for (i=0; i<elM.length; i++) { elM[i].innerHTML = pad(m); }
  for (i=0; i<elH.length; i++) { elH[i].innerHTML = pad(h); }


function draw() {
  var now = new Date();
  delta = (now.getTime()-last.getTime()) / 1000;
  last = now;

  var h = now.getHours();
  var m = now.getMinutes();
  var s = now.getSeconds();
  var ms = now.getMilliseconds();


  if (s !== lastSecond) { updateTimes(s,m,h); }
  lastSecond = s;



var c = Snap('#clock');
var hs ='#handS');
var hts ='#handTextS');
var hm ='#handM');
var htm ='#handTextM');
var hh ='#handH');
var hth ='#handTextH');

if (hs && hm && hh) {


} else {

  console.log('Not all elements could be found.');