Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <div class="card">
  <div class="clock">
    <svg class="hands" viewBox="0 0 32 32">
      <circle class="days" cy="16" cx="16" r="16" ></circle>
      <circle class="hours" cy="16" cx="16" r="16"></circle>
      <circle class="minutes" cy="16" cx="16" r="16" stroke-linecap="round"></circle>
      <circle class="seconds" cy="16" cx="16" r="16" stroke-linecap="round"></circle>
    </svg>
  </div>
  <div class="fabs">
    <div class="fab">
      <div>day</div>
      <div class="time day"></div>
    </div>
    <div class="fab">
      <div>hour</div>
      <div class="time hour"></div>
    </div>
    <div class="fab">
      <div>minute</div>
      <div class="time minute"></div>
    </div>
    <div class="fab">
      <div>second</div>
      <div class="time second"></div>
    </div>
  </div>
  <h6 class="greeting"><h6>
</div>
              
            
!

CSS

              
                @import url(https://zavoloklom.github.io/material-design-iconic-font/css/docs.md-iconic-font.min.css);

body{
  text-align:center;
  background:#eceff1;
}

.card{
  display: block;
  cursor: pointer;
  width:500px;
  height:350px;
  color:#263238;
  margin:50px auto;
  border-radius:5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  font-family: 'Roboto';
  font-weight: 500;
  font-size:16px;
  -webkit-transition: all .1s ease-out;
  -moz-transition: all .1s ease-out;
  -o-transition: all .1s ease-out;
  transition: all .1s ease-out;
  position: relative;
  overflow: hidden;
  z-index: 998;
}

.card:active,
.card:focus,
.card:hover{
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
}

.card>i{
  display:block;
  font-size:100px;
}

.clock {
  width: 120px;
  height: 120px;
  margin:10px auto;
}

.hands {
  width: 100%;
  height: 100%;
  -webkit-transform:rotate(-90deg);
  -ms-transform:rotate(-90deg);
  transform:rotate(-90deg);
  border-radius: 50%;
  -webkit-transition: all .1s ease-out;
  -moz-transition: all .1s ease-out;
  -o-transition: all .1s ease-out;
  transition: all .1s ease-out;
}
circle {
  position: absolute;
  fill: none;
}
.seconds {
  stroke: #212121;
  stroke-width: 5;
  -webkit-transition: all .1s ease-out;
  -moz-transition: all .1s ease-out;
  -o-transition: all .1s ease-out;
  transition: all .1s ease-out;
}
.minutes {
  stroke: #616161;
  stroke-width: 10;
  z-index: 2;
  -webkit-transition: all .1s ease-out;
  -moz-transition: all .1s ease-out;
  -o-transition: all .1s ease-out;
  transition: all .1s ease-out;
}
.hours {
  stroke: #bdbdbd;
  stroke-width: 18;
  z-index: 3;
  -webkit-transition: all .1s ease-out;
  -moz-transition: all .1s ease-out;
  -o-transition: all .1s ease-out;
  transition: all .1s ease-out;
}

.days {
  stroke: #fff;
  stroke-width: 32;
  z-index: 4;
  -webkit-transition: all .1s ease-out;
  -moz-transition: all .1s ease-out;
  -o-transition: all .1s ease-out;
  transition: all .1s ease-out;
}

.greeting{
  font-size:20px;
  color:#263238;
  font-family: 'Roboto';
  font-weight: 600;
}

.fabs {
  margin: 1em auto;
  width:100%;
  height:100px;
}

.fab {
  display: inline-block;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  text-align: center;
  margin: 25px 25px;
  cursor: pointer;
  font-family: 'Roboto';
  font-weight: 500;
  -webkit-transition: all .1s ease-out;
  -moz-transition: all .1s ease-out;
  -o-transition: all .1s ease-out;
  transition: all .1s ease-out;
  position: relative;
  z-index: 997;
  overflow: hidden;
}

.fab>div{
  display:block;
  font-family: 'Roboto';
  font-weight: 500;
  font-size: 10px;
  line-height: 28px;
}

.fab>.time{
  font-size: 2em;
}

/* Ripple */

.ink {
  display: block;
  position: absolute;
  background: rgba(38, 50, 56, 0.4);
  border-radius: 100%;
  -moz-transform: scale(0);
  -ms-transform: scale(0);
  webkit-transform: scale(0);
  transform: scale(0);
}
/*animation effect*/

.ink.animate {
  animation: ripple 0.5s ease-in-out;
}

@keyframes ripple {
  /*scale the element to 250% to safely cover the entire link and fade it out*/
  
  100% {
    opacity: 0;
    -moz-transform: scale(5);
    -ms-transform: scale(5);
    webkit-transform: scale(5);
    transform: scale(5);
  }
}
              
            
!

JS

              
                function updateTime() {
  var today = new Date();
  var nextyear=today.getFullYear()+1;
  var deadline = 'January 1 ' + nextyear + " 00:00:00";
  //var deadline = 'June 2 ' + (today.getFullYear()) + " 15:58:30";
  if (today.getMonth == 0 && today.getDate == 1) {
    deadline = 'January 1 ' + nextyear + " 00:00:00";
  };
  d = timeLeft(deadline);
  if (d.days>=365) {
    $('.card').css('background','#2196F3');
    ripple(".second")
    ripple(".minute");
    ripple(".hour");
    ripple(".day");
    $(".second").html(0);
    $(".minute").html(0);
    $(".hour").html(0);
    $(".day").html(0);
    $(".seconds").css("stroke-dasharray", + Math.floor((Math.random() * 100) + 1) + " 100");
    $(".minutes").css("stroke-dasharray", + Math.floor((Math.random() * 100) + 1) + " 100");
    $(".hours").css("stroke-dasharray", + Math.floor((Math.random() * 100) + 1) + " 100");
    $(".days").css("stroke-dasharray", + Math.floor((Math.random() * 100) + 1) + " 100");
    $('.greeting').html('Welcome to '+today.getFullYear());
  } else {
    if(d.days<=30){
      $('.card').css('background','#ffc107');
    }else if(d.days>30 && d.days<=120){
      $('.card').css('background','#ffeb3b');
    }else{
      $('.card').css('background','#cddc39');
    }
    
    $('.greeting').html('Before '+nextyear);
    var s = d.seconds * 1.68,
      m = d.minutes * 1.68,
      h = d.hours * 4.17,
      d1=d.days * (100/daysInYear(today.getFullYear())),
      s2 = d.seconds,
      m2 = d.minutes,
      h2 = d.hours,
      d2 = d.days;
    $(".seconds").css("stroke-dasharray", +s + " 100");
    $(".minutes").css("stroke-dasharray", +m + " 100");
    $(".hours").css("stroke-dasharray", +h + " 100");
    $(".days").css("stroke-dasharray", +d1 + " 100");
      ripple(".second");
      $(".second").html((s2 < 10 ? "0" : "") + s2);
    if (parseInt($(".minute").html()) !== m2) {
      ripple(".minute");
      $(".minute").html((m2 < 10 ? "0" : "") + m2);
    }
    if (parseInt($(".hour").html()) !== h2) {
      ripple(".hour");
      $(".hour").html((h2 < 10 ? "0" : "") + h2);
    }
    if (parseInt($(".day").html()) !== d2) {
      ripple(".day");
      $(".day").html(d2);
    }
  }
}

function timeLeft(endtime) {
  var t = Date.parse(endtime) - Date.parse(new Date());
  var seconds = Math.floor((t / 1000) % 60);
  var minutes = Math.floor((t / 1000 / 60) % 60);
  var hours = Math.floor((t / (1000 * 60 * 60)) % 24);
  var days = Math.floor(t / (1000 * 60 * 60 * 24));
  return {
    'total': t,
    'days': days,
    'hours': hours,
    'minutes': minutes,
    'seconds': seconds
  };
};

function daysInYear(year) {
    if(year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0)) {
        // Leap year
        return 366;
    } else {
        // Not a leap year
        return 365;
    }
}

// Ripple effect
var target, ink, d, x, y;
$(".fab").click(function(e) {
  target = $(this);
  //create .ink element if it doesn't exist
  if (target.find(".ink").length == 0)
    target.prepend("<span class='ink'></span>");

  ink = target.find(".ink");
  //incase of quick double clicks stop the previous animation
  ink.removeClass("animate");

  //set size of .ink
  if (!ink.height() && !ink.width()) {
    //use parent's width or height whichever is larger for the diameter to make a circle which can cover the entire element.
    d = Math.max(target.outerWidth(), target.outerHeight());
    ink.css({
      height: d,
      width: d
    });
  }

  //get click coordinates
  //logic = click coordinates relative to page - parent's position relative to page - half of self height/width to make it controllable from the center;
  x = e.pageX - target.offset().left - ink.width() / 2;
  y = e.pageY - target.offset().top - ink.height() / 2;

  //set the position and add class .animate
  ink.css({
    top: y + 'px',
    left: x + 'px'
  }).addClass("animate");
});

function ripple(e) {
  target = $(e).parent();
  //create .ink element if it doesn't exist
  if (target.find(".ink").length == 0)
    target.prepend("<span class='ink'></span>");

  ink = target.find(".ink");
  //incase of quick double clicks stop the previous animation
  ink.removeClass("animate");

  //set size of .ink
  if (!ink.height() && !ink.width()) {
    //use parent's width or height whichever is larger for the diameter to make a circle which can cover the entire element.
    d = Math.max(target.outerWidth(), target.outerHeight());
    ink.css({
      height: d,
      width: d
    });
  }

  //get click coordinates
  //logic = click coordinates relative to page - parent's position relative to page - half of self height/width to make it controllable from the center;
  x = e.pageX - target.offset().left - ink.width() / 2;
  y = e.pageY - target.offset().top - ink.height() / 2;

  //set the position and add class .animate
  ink.css({
    top: y + 'px',
    left: x + 'px'
  }).addClass("animate");
}

var clock = setInterval(updateTime, 1000);
              
            
!
999px

Console