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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
                <h1>Pomodoro</h1>

  <main ng-app="PomodoroApp" ng-controller="MainCtrl">

    <section ng-click="toggleTimer()">
      <div id="centerPom">
        <div class="ppBtn">
          <span class="fa-stack fa-lg" ng-show="!run">
            <i class="fa fa-square-o fa-stack-2x"></i>
            <i class="fa fa-play fa-stack-1x"></i>
          </span>
          <span class="fa-stack fa-lg" ng-show="run">
            <i class="fa fa-square-o fa-stack-2x"></i>
            <i class="fa fa-pause fa-stack-1x"></i>
          </span>
        </div>
        <div class="rotateEgg " ng-style="{'transform': rotateEggs}">
          <div class="timerSmall " ng-style="{'transform': rotate}">
            <p class="title" ng-show="actionStatus ==='Relax' && run">{{actionStatus}}</p>
            <p class="mid" ng-show="actionStatus ==='Work' && run">{{timeWork}}</p>
            <span ng-style="{'height':upFill,'width':pauseSand, 'background':fillColor }" class="fill"></span>
          </div>
          <div class="timerBig " ng-style="{'transform': rotate}">
            <p class="title" ng-show="actionStatus=== 'Work'&& run">{{actionStatus}}</p>
            <p class="mid" ng-show="actionStatus=== 'Relax'&& run">{{timeBreak}}</p>
            <span ng-style="{'height':downFill, 'width':pauseSand, 'background':fillColor }" class="fill"></span>
          </div>
        </div>
      </div>
    </section>
    <footer class="cssFade" ng-hide="run">
      <div class="setTime">
        <div class="breakCtrl">
          <p>Relax</p>
          <button ng-click="relaxLengthChange(-1)" class="minus">-</button>
          <span class="time">{{relaxLength}}</span>
          <button ng-click="relaxLengthChange(1)" class="plus">+</button>
        </div>
        <div class="sessionCtrl">
          <p>Work</p>
          <button ng-click="workLengthChange(-1)" class="minus">-</button>
          <span class="time">{{workLength}}</span>
          <button ng-click="workLengthChange(1)" class="plus">+</button>
        </div>
      </div>
    </footer>
  </main>
            
          
!
            
              * {
  margin: 0;
  font-family: 'Indie Flower', cursive;
}
html, body, main {
  height: 100%;
  background-color: #333333;
}
h1 {
  display: block;
  margin: 0 auto;
  color: white;
  text-align: center;
  font-family: 'Indie Flower', cursive;
  font-size: 5em;
  letter-spacing: 10px;
}
.mid {
  margin-top: 100px;
}
.ppBtn{
  margin-bottom: 15px;
  color: #fff !important;
  font-size: 2em;
  text-align: center;
  text-shadow: 0px 0px !important;


}
.fa-stack {
  line-height:1.85em !important;
  cursor: pointer;
}
section {
  color: #fff;
  font-weight: bold;
  font-size: 1.2em;
  text-shadow: 1px 1px #000;
}
section .title {
  margin-top: 80px;
  text-align: center;
  line-height: 80px;
  font-size: .8em;
}
section .timerSmall {
  margin: 0 auto;
  text-align: center;
  width: 200px;
  height: 250px;
  font-size: 4em;
  border: 5px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
section .timerSmall:before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 50%;
  border: 5px solid rgb(70, 70, 70);
}
section .timerBig {
  margin: 0 auto;
  margin-top: -5px;
  text-align: center;
  width: 200px;
  height: 250px;
  font-size: 4em;
  border: 5px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
section .timerBig:before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 50%;
  border: 5px solid rgb(70, 70, 70);
}
 .fill {
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  z-index: -1;
  transition: width 1.5s, height .1s;
}
#centerPom {
  width: 50%;
  margin: 0 auto;
}
.rotateEgg {
  margin: 0 auto;
  padding: 5px;
  border: 2px solid white;
  border-radius: 20px;
  box-shadow: 0 0 5px 5px gray inset;
  background-color: rgb(70, 70, 70);
  width: 218px;
  transition: transform 1s;
}

footer {
  display: flex;
  justify-content: center;
  text-align: center;
  color: #fff;
  text-transform: uppercase;
  padding: 20px;

}
footer.cssFade {
    transition: 1.5s linear all;
    opacity: 1;
}
footer.cssFade.ng-hide {
    opacity: 0;
}
footer .setTime {
  font-size: 1.5em;
  display: flex;
}
footer .setTime .breakCtrl, footer .setTime .sessionCtrl {
  display: inline;
  padding-left: 30px;
  padding-right: 30px;
}
footer .setTime .minus, footer .setTime .plus {
  background-color: #333333;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 4em;
  outline: none;
}
footer .setTime .time {
  font-size: 2.5em;
  padding-left: 10px;
  padding-right: 10px;
}

            
          
!
            
              var app = angular.module('PomodoroApp', ['ngAnimate']);
var bell = "budhistBell.mp3";
var audio = new Audio(bell);
app.controller('MainCtrl', function($scope, $interval) {
  $scope.relaxLength = 5;
  $scope.workLength = 25;
  $scope.timeWork = secondsToHms($scope.workLength * 60);
  $scope.upFill = '100%';
  $scope.downFill = '0%';
  $scope.actionStatus = 'Work';
  $scope.first = true;
  $scope.rotateEggs = 'rotate(180deg)';
  console.log("eggs " + $scope.rotateEggs);
  $scope.fillColor = "#ffcc66";
  $scope.run = false;
  $scope.pauseSand = '100%';

  $scope.originalTime = $scope.workLength;
  var secs = 60 * $scope.workLength;

  function secondsToHms(d) {
    d = Number(d);
    var h = Math.floor(d / 3600);
    var m = Math.floor(d % 3600 / 60);
    var s = Math.floor(d % 3600 % 60);
    return (
      (h > 0 ? h + ":" + (m < 10 ? "0" : "") : "") + m + ":" + (s < 10 ? "0" : "") + s
    );
  }

  // Change default session length
  $scope.workLengthChange = function(time) {
    if (!$scope.run) {
      $scope.workLength += time;
      if ($scope.workLength < 0) {
        $scope.workLength = 0;
      }
      if ($scope.actionStatus === 'Work') {
        $scope.originalTime = $scope.workLength;
        secs = 60 * $scope.workLength;
      }
    }
  };
  $scope.relaxLengthChange = function(time) {
    if (!$scope.run) {
      $scope.relaxLength += time;
      if ($scope.relaxLength < 0) {
        $scope.relaxLength = 0;
      }
      if ($scope.actionStatus === 'Relax') {
        $scope.originalTime = $scope.relaxLength;
        secs = 60 * $scope.relaxLength;
      }
    }
  };
  $scope.toggleTimer = function() {
    console.log($scope.actionStatus);
    audio.play();
    $scope.first = false;
    if (!$scope.run) {
      $scope.pauseSand = '100%';
      updateTimer();
      $scope.run = $interval(updateTimer, 1000);
      if ($scope.actionStatus === 'Work') {
        $scope.rotateEggs = 'rotate(0deg)';
        console.log("eggs " + $scope.rotateEggs);
      } else {
        $scope.rotateEggs = 'rotate(180deg)';
        console.log("eggs " + $scope.rotateEggs);
      }
    } else {
      $interval.cancel($scope.run);
      if ($scope.actionStatus === 'Work') {
        $scope.rotateEggs = 'rotate(-90deg)';
        console.log("eggs " + $scope.rotateEggs);
        $scope.upFill = '100%';
        $scope.downFill = '100%';
        $scope.pauseSand = '30%';
      } else {
        $scope.rotateEggs = 'rotate(90deg)';
        console.log("eggs " + $scope.rotateEggs);
        $scope.upFill = '100%';
        $scope.downFill = '100%';
        $scope.pauseSand = '30%';
      }
      $scope.run = false;
    }
  };

  function updateTimer() {
    secs -= 1;
    if (secs < 0) {
      audio.play();
      // rotate eggs

      if ($scope.actionStatus === 'Relax') {
        $scope.actionStatus = 'Work';
        $scope.currentLength = $scope.workLength;
        $scope.timeWork = 60 * $scope.workLength;
        $scope.originalTime = $scope.workLength;
        secs = 60 * $scope.workLength;
        $scope.rotateEggs = 'rotate(0deg)';
        console.log("eggs " + $scope.rotateEggs);
        $scope.rotate = 'rotate(0deg)';
        console.log($scope.rotate);
      } else {
        $scope.actionStatus = 'Relax';
        $scope.currentLength = $scope.relaxLength;
        $scope.timeBreak = 60 * $scope.relaxLength;
        $scope.originalTime = $scope.relaxLength;
        secs = 60 * $scope.relaxLength;
        $scope.rotateEggs = 'rotate(180deg)';
        console.log("eggs " + $scope.rotateEggs);
        $scope.rotate = 'rotate(180deg)';
        console.log($scope.rotate);
      }
    } else {
      if ($scope.actionStatus === 'Relax') {
        $scope.fillColor = "#ffcc66";
        $scope.timeBreak = secondsToHms(secs);
        var perc = 100 - (secs / (60 * $scope.originalTime)) * 100;
        var percUp = (secs / (60 * $scope.originalTime)) * 100;
        $scope.upFill = perc + "%";
        $scope.downFill = percUp + "%";
      } else {
        $scope.fillColor = "#ffcc66";
        $scope.timeWork = secondsToHms(secs);
        var perc2 = 100 - (secs / (60 * $scope.originalTime)) * 100;
        var percUp2 = (secs / (60 * $scope.originalTime)) * 100;
        $scope.upFill = percUp2 + "%";
        $scope.downFill = perc2 + "%";
      }

    }
  }

});

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console