<html lang="en">
   <head>
      <meta charset="utf-8">
      <title>Properties</title>
      <link rel="stylesheet" href="style.css">
   </head>
   <body>
      <span onclick="unmorph()">close</span>
      <div class="outer" onclick="morph()">
          <div class="circle"></div>
      </div>

      <script src="bower_components/animejs/anime.js"></script>
      <script src="expt.js"></script>
   </body>
</html>
body{
	width: 100%;
	height: 100%;
	background-color: #F0F2F4;
}

.outer{
	position: fixed;
	bottom: 0;
	right: 0;
	margin: 20px;
	z-index: 10;
}
.circle{
	width: 48px;
    height: 48px;
    background-color: #FF7C72;
    border-radius: 100%;
}
function morph() {
	var square = anime({
		targets: '.circle',
		duration: 300,
		width: {
			value: '300px',
			easing: 'easeInOutQuart'
		},
		height: {
			value: '500px',
			easing: 'easeInOutQuart'
		},
		borderRadius: '0%',
	})
	var promise = square.finished.then(function(res) {
		console.log('Morph Complete');
	});
}

function unmorph() {
	var square = anime({
		targets: '.circle',
		duration: 300,
		width: {
			value: '48px',
			easing: 'easeInQuart'
		},
		height: {
			value: '48px',
			easing: 'easeInQuart'
		}
	})
	var promise = square.finished.then(function() {
		var square = anime({
			targets: '.circle',
			duration: 100,
			borderRadius: '100%',
			easing: 'linear'
		})
	})
}
console.log(anime.easings);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/animejs/2.2.0/anime.min.js