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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

	<title>Pomodoro Clock</title>
	<div class="centered-block">
		<h2>Pomodoro Timer</h2>
		<div class="row">
			<div class="col-xs-3"></div>
			<div class="col-xs-3">
				Work Time
				<div class="row">
					<div class="col-xs-4">
						<div id="plusWork" class="btn btn-default">+</div>
					<div id="workTime" class="col-xs-4 big fcc-background">
					<div class="col-xs-4">
						<div id="lessWork" class="btn btn-default">-</div>

			<div class="col-xs-3">
				Rest Time
				<div class="row">
					<div class="col-xs-4">
						<div id="plusRest" class="btn btn-default">+</div>
					<div id="restTime" class="col-xs-4 big fcc-background">
					<div class="col-xs-4">
						<div id="lessRest" class="btn btn-default">-</div>
		<svg width="250" height="250" >
    			<pattern id="image" patternUnits="userSpaceOnUse" height="250" width="250">
      			<image x="0" y="0" height="250" width="250" xlink:href=""></image>
 			<circle id='top' cx="125" cy="125" r="125" fill="url(#image)"/>
  			<path id="loader" transform="translate(125, 125)"/>
		<div id="announcment">READY TO WORK</div>
		<div id="timer" class="big button"></div>
		<button id="start">start</button>
		<button id="stop">stop</button>
		<button id="reset">reset</button>

              body {
	background-color: #457E86 !important;

.centered-block {
	margin-top: 30px;
	text-align: center;
	background-image: url(;
	background-repeat: no-repeat;
	background-size: cover;
	padding-bottom: 30px;
	font-family: monospace;
	border:10px solid #4A2B0F;

h2 {
	color: #EEEEEE;
	padding-top: 30px;
  text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;

.big {
	font-size: 2em;

.button {
	cursor: pointer;

svg {
  display: block;
  margin: 50px auto;

#loader { 
	fill: red;
  opacity: 0.3;	}

.fcc-background {
	background-color: #4A2B0F;
	color: white;
	border-radius: 15px;


	timer.setTimer(); //For getting the timer ready
                    //when the page is loaded




		modifyNumber("#workTime", +1);

		modifyNumber("#restTime", +1);

		modifyNumber("#workTime", -1);

		modifyNumber("#restTime", -1);


function modifyNumber(numberId, modifier){
	var current = parseInt($(numberId).text(), 10);
  if(current + modifier >= 0){
    $(numberId).text(current + modifier);

function getUserTime(timerId){
	//gets the time in minutes and returns it as seconds
	return parseInt($(timerId).text(), 10) * 60;

var timer = {
	totalSeconds: null,
	runningTime: null,
	timeHandler: null,	//handler which will run the setInterval function
	svgHandler: null,	//handler for the svg animation

	isWorkTime: true,	//For knowing if we must run the work timer or
						//the rest timer

	getTime: function(){
		function formating(value){
			value = value.toString();
			if(value.length < 2){
				return '0' + value;
			} else {
				return value;
		var minutes = Math.floor(this.runningTime / 60);
		var totalSeconds = this.runningTime - (minutes * 60);
		return formating(minutes) + " : " + formating(totalSeconds);
	resetTime: function(){
	startTimer: function(){
		var that = this; //allows to refer to the timer object
		this.timeHandler = setInterval(function(){
			if(that.runningTime > 0){
			} else{

				that.isWorkTime = !that.isWorkTime;	//changes the bool value of
													//the variable when the timer
													//is out of time

			that.svgHandler(that.totalSeconds - that.runningTime);
		}, 1000);
	stopTimer: function(){
	setTimer: function(){
		var color; //color for the svg animation
		var timerId;
		var timerMessage;
			color = "red";
			timerId = "#workTime";
			timerMessage = "WORK TIME!!";
		} else {
			color = "green";
			timerId = "#restTime";
			timerMessage = "REST TIME!!";

		var seconds = parseInt($(timerId).text(), 10) * 60;
		this.totalSeconds = seconds;
		this.runningTime = seconds;

		this.svgHandler = animationHandler(seconds, color);
		this.svgHandler(this.totalSeconds - this.runningTime);

	getIsWorkTime: function(){
		return this.isWorkTime;

//Credits for Andreu Grimsrud who build a SVG pie
//timer which was the foundation for this animation

function animationHandler(seconds, color){
  var loader = document.getElementById("loader");
  var alpha = 0;
  var pi = Math.PI;
  var t = 30;
  var totalTimePeriod = seconds;
  $('#loader').css("fill", color);
  function draw(secs) {
    alpha = 360 * (secs/totalTimePeriod);
    var r = ( alpha * pi / 180 );
    var x = Math.sin( r ) * 125;
    var y = Math.cos( r ) * - 125;
    var mid = ( alpha > 180 ) ? 1 : 0;
    var anim = 'M 0 0 v -125 A 125 125 1 ' +
            mid + ' 1 ' +
             x  + ' ' +
             y  + ' z';
    loader.setAttribute( 'd', anim );

  return draw;

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.