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

              
                <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="400px" height="400px" viewBox="0 0 400 400" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
    <!-- Generator: Sketch 3.3.2 (12043) - http://www.bohemiancoding.com/sketch -->
    <title>Clock 2</title>
    <desc>Created with Sketch.</desc>
    <defs>
        <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
            <feOffset dx="0" dy="1" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
            <feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
            <feColorMatrix values="0 0 0 0 0   0 0 0 0 0   0 0 0 0 0  0 0 0 0.35 0" in="shadowBlurOuter1" type="matrix" result="shadowMatrixOuter1"></feColorMatrix>
            <feMerge>
                <feMergeNode in="shadowMatrixOuter1"></feMergeNode>
                <feMergeNode in="SourceGraphic"></feMergeNode>
            </feMerge>
        </filter>
        <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-2">
            <feOffset dx="0" dy="1" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
            <feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
            <feColorMatrix values="0 0 0 0 0   0 0 0 0 0   0 0 0 0 0  0 0 0 0.195309669 0" in="shadowBlurOuter1" type="matrix" result="shadowMatrixOuter1"></feColorMatrix>
            <feMerge>
                <feMergeNode in="shadowMatrixOuter1"></feMergeNode>
                <feMergeNode in="SourceGraphic"></feMergeNode>
            </feMerge>
        </filter>
        <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-3">
            <feOffset dx="0" dy="1" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
            <feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
            <feColorMatrix values="0 0 0 0 0   0 0 0 0 0   0 0 0 0 0  0 0 0 0.35 0" in="shadowBlurOuter1" type="matrix" result="shadowMatrixOuter1"></feColorMatrix>
            <feMerge>
                <feMergeNode in="shadowMatrixOuter1"></feMergeNode>
                <feMergeNode in="SourceGraphic"></feMergeNode>
            </feMerge>
        </filter>
        <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-4">
            <feOffset dx="0" dy="2" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
            <feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
            <feColorMatrix values="0 0 0 0 0   0 0 0 0 0   0 0 0 0 0  0 0 0 0.139512568 0" in="shadowBlurOuter1" type="matrix" result="shadowMatrixOuter1"></feColorMatrix>
            <feMerge>
                <feMergeNode in="shadowMatrixOuter1"></feMergeNode>
                <feMergeNode in="SourceGraphic"></feMergeNode>
            </feMerge>
        </filter>
    </defs>
    <g id="Stickersheet" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
        <g id="Clock-2" sketch:type="MSArtboardGroup">
            <g id="Clock" sketch:type="MSLayerGroup" transform="translate(-49.933013, -49.250000)">
                <g id="background-minute" transform="translate(249.500000, 249.500000) rotate(90.000000) translate(-249.500000, -249.500000) translate(67.000000, 67.000000)" sketch:type="MSShapeGroup">
                    <path d="M182.933013,364.25 C283.448837,364.25 364.933013,282.765824 364.933013,182.25 C364.933013,81.7341755 283.448837,0.25 182.933013,0.25 C82.4171882,0.25 0.933012702,81.7341755 0.933012702,182.25 C0.933012702,282.765824 82.4171882,364.25 182.933013,364.25 Z" id="background-marker" fill="#AAAAAA"></path>
 
                    <path d="M57.9330127,238.25 C88.8609587,238.25 113.933013,213.177946 113.933013,182.25 C113.933013,151.322054 88.8609587,126.25 57.9330127,126.25 C27.0050667,126.25 1.9330127,151.322054 1.9330127,182.25 C1.9330127,213.177946 27.0050667,238.25 57.9330127,238.25 Z" id="minute-marker" class="marker" fill="#E0ECFA" filter="url(#filter-1)"></path>
                </g>
                <g id="background-hour" transform="translate(249.500000, 249.500000) rotate(-30.000000) translate(-249.500000, -249.500000) translate(100.000000, 100.000000)" sketch:type="MSShapeGroup">
                    <path d="M149.933013,298.25 C232.22344,298.25 298.933013,231.540428 298.933013,149.25 C298.933013,66.9595723 232.22344,0.25 149.933013,0.25 C67.642585,0.25 0.933012702,66.9595723 0.933012702,149.25 C0.933012702,231.540428 67.642585,298.25 149.933013,298.25 Z" id="background-hour" fill="#D8D8D8" filter="url(#filter-2)"></path>
                    <path d="M48.9330127,195.25 C74.8903959,195.25 95.9330127,174.207383 95.9330127,148.25 C95.9330127,122.292617 74.8903959,101.25 48.9330127,101.25 C22.9756295,101.25 1.9330127,122.292617 1.9330127,148.25 C1.9330127,174.207383 22.9756295,195.25 48.9330127,195.25 Z" id="hour-marker" class="marker" fill="#8DB2DD" filter="url(#filter-3)"></path>
                </g>
                <circle cx="0" cy="0" r="116" fill="#4A90E2" transform="translate(250, 250)" id="Forground-center" />
                <g id="Hands" transform="translate(73.000000, 76.000000)" font-weight="normal" font-family="Roboto" fill="#000000" sketch:alignment="middle" font-size="18" sketch:type="MSTextLayer">
                    <g id="time-hand" transform="translate(165.000000, 0.000000)">
                        <text id="00" class="minute number">
                            <tspan x="1.21941036" y="17">00</tspan>
                        </text>
                        <text id="h12" class="hour number">
                            <tspan x="1.21941036" y="48.6005472">12</tspan>
                        </text>
                    </g>
                    <g id="time-hand-copy" transform="translate(251.000000, 46.500000) rotate(30.000000) translate(-251.000000, -46.500000) translate(239.000000, 19.000000)">
                        <text id="05" class="minute number">
                            <tspan x="2.84647808" y="17.1916365">05</tspan>
                        </text>
                        <text id="h1" transform="translate(11.241232, 42.201057) rotate(-30.000000) translate(-11.241232, -42.201057) " class="hour number">
                            <tspan x="6.17433789" y="48.7010573">1</tspan>
                        </text>
                    </g>
                    <g id="time-hand-copy-2" transform="translate(305.000000, 101.000000) rotate(60.000000) translate(-305.000000, -101.000000) translate(292.000000, 72.000000)">
                        <text id="10" class="minute number">
                            <tspan x="3.53986162" y="17.2889577">10</tspan>
                        </text>
                        <text id="h2" transform="translate(13.249297, 46.117777) rotate(-60.000000) translate(-13.249297, -46.117777) " class="hour number">
                            <tspan x="8.18240222" y="51.8399995">2</tspan>
                        </text>
                    </g>
                    <g id="time-hand-copy-3" transform="translate(327.000000, 174.234171) rotate(90.000000) translate(-327.000000, -174.234171) translate(316.000000, 150.234171)">
                        <text id="15" class="minute number" transform="translate(11.386603, 10.500000) rotate(-90.000000) translate(-11.386603, -10.500000) ">
                            <tspan x="1.25281368" y="17">15</tspan>
                        </text>
                        <text id="h3" transform="translate(11.386603, 41.188774) rotate(-90.000000) translate(-11.386603, -41.188774) " class="hour number">
                            <tspan x="6.31970821" y="47.6887737">3</tspan>
                        </text>
                    </g>
                    <g id="time-hand-copy-4" transform="translate(306.000000, 249.000000) rotate(120.000000) translate(-306.000000, -249.000000) translate(293.000000, 220.000000)">
                        <text id="20" transform="translate(13.772122, 11.480800) scale(-1, -1) translate(-13.772122, -11.480800) " class="minute number" >
                            <tspan x="3.63833329" y="17.4080727">20</tspan>
                        </text>
                        <text id="h4" transform="translate(12.824943, 45.675553) rotate(-120.000000) translate(-12.824943, -45.675553) " class="hour number">
                            <tspan x="7.7580483" y="51.6028255" >4</tspan>
                        </text>
                    </g>
                    <g id="time-hand-copy-5" transform="translate(251.000000, 302.500000) rotate(151.000000) translate(-251.000000, -302.500000) translate(239.000000, 275.000000)">
                        <text id="25" transform="translate(10.543677, 10.589059) scale(-1, -1) translate(-10.543677, -10.589059) " class="minute number">
                            <tspan x="0.409888401" y="17.089059">25</tspan>
                        </text>
                        <text id="h5" transform="translate(12.395716, 42.146253) rotate(210.000000) translate(-12.395716, -42.146253) " class="hour number">
                            <tspan x="7.32882181" y="48.6462533">5</tspan>
                        </text>
                    </g>
                    <g id="time-hand-copy-6" transform="translate(176.000000, 323.003012) rotate(180.000000) translate(-176.000000, -323.003012) translate(165.000000, 297.003012)">
                        <text id="30" transform="translate(11.490743, 10.500000) scale(-1, -1) translate(-11.490743, -10.500000) " class="minute number">
                            <tspan x="1.35695345" y="17">30</tspan>
                        </text>
                        <text id="h6" transform="translate(11.490743, 41.198201) scale(-1, -1) translate(-11.490743, -41.198201) " class="hour number">
                            <tspan x="6.42384798" y="47.6982006">6</tspan>
                        </text>
                    </g>
                    <g id="time-hand-copy-7" transform="translate(103.500000, 305.000000) rotate(210.000000) translate(-103.500000, -305.000000) translate(92.000000, 276.000000)" >
                        <text id="35" transform="translate(12.188412, 11.275786) scale(-1, -1) translate(-12.188412, -11.275786) " class="minute number">
                            <tspan x="2.05462288" y="17.4007857">35</tspan>
                        </text>
                        <text id="h7" transform="translate(11.241232, 44.859918) rotate(150.000000) translate(-11.241232, -44.859918) " class="hour number">
                            <tspan x="6.17433789" y="50.9849179">7</tspan>
                        </text>
                    </g>
                    <g id="time-hand-copy-8" transform="translate(50.000000, 250.500000) rotate(240.000000) translate(-50.000000, -250.500000) translate(37.000000, 222.000000)">
                        <text id="40" transform="translate(12.302117, 11.282855) scale(-1, -1) translate(-12.302117, -11.282855) " class="minute number">
                            <tspan x="2.16832817" y="17.401037">40</tspan>
                        </text>
                        <text id="h8" transform="translate(13.249297, 44.888043) rotate(120.000000) translate(-13.249297, -44.888043) " class="hour number">
                            <tspan x="8.18240222" y="51.0062251" >8</tspan>
                        </text>
                    </g>
                    <g id="time-hand-copy-9" transform="translate(26.000000, 177.500000) rotate(-90.000000) translate(-26.000000, -177.500000) translate(15.000000, 152.000000)">
                        <text id="45" transform="translate(10.561344, 11.517692) rotate(90.000000) translate(-10.561344, -11.517692) " class="minute number">
                            <tspan x="0.427555155" y="17.8076923" >45</tspan>
                        </text>
                        <text id="h9" transform="translate(10.561344, 43.944222) rotate(90.000000) translate(-10.561344, -43.944222) " class="hour number">
                            <tspan x="5.49444969" y="50.2342218" >9</tspan>
                        </text>
                    </g>
                    <g id="time-hand-copy-10" transform="translate(47.471661, 101.983639) rotate(-60.000000) translate(-47.471661, -101.983639) translate(32.971661, 71.983639)">
                        <text id="50" class="minute number">
                            <tspan x="2.26679984" y="17.0194642" >50</tspan>
                        </text>
                        <text id="h10" transform="translate(14.408653, 44.896735) rotate(60.000000) translate(-14.408653, -44.896735) " class="hour number">
                            <tspan x="4.27486417" y="51.3967346" >10</tspan>
                        </text>
                    </g>
                    <g id="time-hand-copy-11" transform="translate(102.000000, 47.000000) rotate(-30.000000) translate(-102.000000, -47.000000) translate(87.000000, 17.000000)">
                        <text id="55"  class="minute number">
                            <tspan x="2.69518593" y="17.1035051">55</tspan>
                        </text>
                        <text id="h11" transform="translate(14.780187, 44.748394) rotate(30.000000) translate(-14.780187, -44.748394) " class="hour number">
                            <tspan x="4.64639762" y="50.8863254">11</tspan>
                        </text>
                    </g>
                </g>
            </g>
        </g>
    </g>
</svg>
              
            
!

CSS

              
                .minute-marker {
  cursor: pointer;
}

.marker, .number {
  cursor: pointer;
}

text {
  font-weight:bold;
}
              
            
!

JS

              
                var rotations = [
  {id : "h12", rot: 90, type: 'hour'},
  {id : "h1", rot : 120, type: 'hour'},
  {id : "h2", rot: 150, type: 'hour'},
  {id : "h3", rot: 180, type: 'hour'},
  {id : "h4", rot: 210, type: 'hour'},
  {id : "h5", rot : 240, type: 'hour'},
  {id : "h6", rot : 270, type: 'hour'},
  {id : "h7", rot : 300, type: 'hour'},
  {id : "h8", rot : 330, type: 'hour'},
  {id : "h9", rot : 0, type: 'hour'},
  {id : "h10", rot : 30, type: 'hour'},
  {id : "h11", rot : 60, type: 'hour'},
  {id : "00", rot : 90, type: 'minute'},
  {id : "05", rot  : 120, type: 'minute'},
  {id : "10", rot  : 150, type: 'minute'},
  {id : "15", rot  : 180, type: 'minute'},
  {id : "20", rot  : 210, type: 'minute'},
  {id : "25", rot  : 240, type: 'minute'},
  {id : "30", rot  : 270, type: 'minute'},
  {id : "35", rot  : 300, type: 'minute'},
  {id : "40", rot  : 330, type: 'minute'},
  {id : "45", rot  : 0, type: 'minute'},
  {id : "50", rot  : 30, type: 'minute'},
  {id : "55", rot  : 60, type: 'minute'}
];

function init() {
  var elem, i, conf, l;
  for (i = 0; i < rotations.length; i++) {
    conf = rotations[i];
    elem = document.getElementById(conf.id);
    l = setMarkerRot.bind(this, 'background-' + conf.type, conf.rot);
    elem.addEventListener('click', l);
  }
}
/**
 * @param {string} id
 * @param {number} rot
 */
function setMarkerRot(id, rot) {
  var marker = document.getElementById(id);
  var transforms = marker.transform.baseVal;
  rotateTransforms(transforms, rot);
}

/**
 * @param {Array<SVGTransform>} transforms
 * @param {number} rot
 */
function rotateTransforms(transforms, rot) {
  var len = transforms.length || transforms.numberOfItems,
      item;
  
  for( var i = 0; i < len; i++ ) {
    item = transforms.getItem(i);
    if (item.type === 4 ){
      item.setRotate(rot, 0, 0);
      break;
    }
  }
}

init();
              
            
!
999px

Console