cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<body>  
  <div class="container-fluid text-center">
       
    <div class="row"> <!-- for title -->
      <h1> Pomodoro Clock </h1>
      
    </div> <!-- end title -->
    
    <div class="row"> <!-- for main -->
      <!-- where all magin begins -->
       <div class="row top-row">
      <div class="col-xs-6 text-primary">
        <h3>Break</h3>
      </div>
      <div class="col-xs-6 text-primary">
        <h3>Session</h3>
      </div>
    </div>

    <div class="row">
      <div class="col-xs-6">
        <button type="button" class="btn btn-link btn-sm" id="minus">-</button>
        <button type="button" class="btn btn-link btn-lg" id="break-time">5</button>
        <button type="button" class="btn btn-link btn-sm" id="plus">+</button>
      </div>
      <div class="col-xs-6">
        <button type="button" class="btn btn-link btn-sm" id="minus2">-</button>
        <button type="button" class="btn btn-link btn-lg" id="work-time">25</button>
        <button type="button" class="btn btn-link btn-sm" id="plus2">+</button>
      </div>
    </div>

    <div class="row top-row">
      <h3 id="status">Work!</h3>
      <canvas id="progress"></canvas>
      <div id="timer"></div>
    </div>
    <div class="row top-row bottom">
      <button type="button" class="btn btn-link" id="start"> Start
      </button>
      <button type="button" class="btn btn-link" id="pause"> Pause
      </button>
      <button type="button" class="btn btn-link" id="reset"> Reset
      </button>
    </div>
      
      <!-- where all magic ends -->
    </div> <!-- end main -->
    
   <div class="row text-center"> <!-- for footer -->
      <h5><a href="http://www.eleftheriabatsou.com" target="_blank">Eleftheria </a> | <a href="https://codepen.io/EleftheriaBatsou" target="_blank">Projects</a> | <a href="https://www.youtube.com/channel/UCC-WwYv3DEW7Nkm_IP6VeQQ" target="_blank"> Coding videos </a></h5>
    </div> <!-- end footer -->
  
  </div> <!-- end class container-fluid --> 
</body>
   
            
          
!
            
              body {
  background-color: #4CF3FF; /* light blue */
  color: #B24900; /* brown */
}

a:link    {color:#B24900;  text-decoration:none}
a:visited {color:#B24900; text-decoration:none}
a:hover   {color:#FF8633; text-decoration:underline} /* Yellow */

h1, h3 {
    font-family: Lobster, Monospace;
}
h1{
  font-size: 450%;
}

/* start: main part */

.top-row {
  margin-top: -10px
}
.bottom {
  margin-bottom: 10px;
}

/* end: main part*/
.btn{
  color: #B24900;
}

            
          
!
            
              $workT = $('#work-time');
$breakT = $('#break-time');
$status = $('#status');

// Controls for Break Length
$('#minus').click(function() {
  $status.text('Break!');
  if (+$breakT.text() > 1) {
    $breakT.text(+$breakT.text() - 1);
  }
});

$('#plus').click(function() {
  $status.text('Break!');
  $breakT.text(+$breakT.text() + 1);
});

// Controls for Session Length
$('#minus2').click(function() {
  $status.text('Work!');
  if (+$workT.text() > 1) {
    $workT.text(+$workT.text() - 1);
  }
});

$('#plus2').click(function() {
  $status.text('Work!');
  $workT.text(+$workT.text() + 1);
});

var audio = new Audio('http://soundbible.com/grab.php?id=1377&type=mp3');

function beep() {

  audio.play();
}

function pad(val) {
  return ('00' + val).slice(-2);
}

var el = document.getElementById('timer');

function updateDisplay(t) {
  var hours = Math.floor(t / 3600);
  t -= hours * 3600;
  var minutes = Math.floor(t / 60);
  t -= minutes * 60;
  var seconds = Math.floor(t);
  el.innerHTML = pad(hours) + ':' + pad(minutes) + ':' + pad(seconds);
}

time = 0;
updateDisplay(time);
var running = true;
var tlast = (new Date()).getTime();

function update() {
  if (time <= 0.0) { // Already done
    return;
  }
  var tnow = (new Date()).getTime();
  var dt = (tnow - tlast) / 1000.0;
  tlast = tnow;
  time -= dt;
  if ($status.text() === 'Work!') {
    totalTime = ($workT.text() * 60);
    water = 'rgba(25, 139, 201, 1)';
  }

  if ($status.text() === 'Break!') {
    totalTime = ($breakT.text() * 60);
    water = '#FF8633'; //brown light
  }

  fraction = 1 - (time / totalTime);

  $('#progress').waterbubble({
    data: fraction,
    animation: false,
    waterColor: water,
  });

  if (time <= 0.0) {
    //el.innerHTML = 'Finished';
    if ($status.text() === 'Work!') {
      beep();
      $status.text('Break!');
      time = $breakT.text() * 60;

    } else {
      beep();
      $status.text('Work!');
      time = $workT.text() * 60;

    }
  }
  updateDisplay(time);
  if (running) {
    requestAnimationFrame(update);
  }

}

function run() {
  $status.text('Work!');
  if (time <= 0.0) {
    time = $workT.text() * 60;
  }
  tlast = (new Date()).getTime();
  running = true;
  requestAnimationFrame(update);
}

function pause() {
  running = false;
}

function stop() {
  running = false;
  time = 0;
  el.innerHTML = '00:00:00';
  $status.text('Work!');
  $workT.text(55);
  $breakT.text(5);
  $('#progress').waterbubble({
    data: 0.0,
    animation: false,
    waterColor: '#FF8633' //brown
  });
}

var bStart = document.getElementById('start');
var bPause = document.getElementById('pause');
var bReset = document.getElementById('reset');

bStart.onclick = run;
bPause.onclick = pause;
bReset.onclick = stop;

$('#progress').waterbubble(

  {

    // bubble size
    radius: 100,
    // border width
    lineWidth: 15,
    // data to present
    data: 0.0,
    // color of the water bubble
    waterColor: '#FF8633', //brown
    // text color
    textColor: '#FF8633',
    // custom font family
    font: '',
    // show wave
    wave: true,
    // custom text displayed inside the water bubble
    txt: undefined,
    // enable water fill animation
    animation: false

  });
            
          
!
999px
Loading ..................

Console