var items = [ [ 1, 1,24, 1,24,24, 1,24], [26, 1,49, 1,49,24,26,24], [51, 1,74, 1,74,24,51,24], [76, 1,99, 1,99,24,76,24], [ 1, 26,24, 26,24,49, 1,49], [26, 26,49, 26,49,49,26,49], [51, 26,74, 26,74,49,51,49], [76, 26,99, 26,99,49,76,49], [ 1, 51,24, 51,24,74, 1,74], [26, 51,49, 51,49,74,26,74], [51, 51,74, 51,74,74,51,74], [76, 51,99, 51,99,74,76,74], [ 1, 76,24, 76,24,99, 1,99], [26, 76,49, 76,49,99,26,99], [51, 76,74, 76,74,99,51,99], [76, 76,99, 76,99,99,76,99] ], item = [],points= [],i, p=[],open = 0, s = Snap().attr({viewBox:"0 0 100 100","fill":"#585247"}); function runAnimations(el) { if( !animationSequences.length ) return; var sequence = animationSequences.shift(); el.animate(sequence,120,mina.linear, runAnimations.bind(null,el)); } function register(x,i) { item[i] = s.polygon(items[i]); item[i].click(function () { var featured = s.polygon(items[i]).attr({"fill":"#585247"}); p = items[i]; animationSequences = [ {"points": p[0]/2+","+p[1]/2+","+p[2]+","+p[3]+","+p[4]+","+p[5]+","+p[6]+","+p[7]}, {"points": p[0]/3+","+p[1]/3+",100,0,100,100,"+p[6]+","+p[7]}, {"points": p[0]/4+","+p[1]/4+",100,0,100,100,0,100"}, {"points": "0,0,100,0,100,100,0,100"}, ]; runAnimations(featured); featured.animate({"fill":"#ACA696"},300); featured.click(function(){ this.stop().animate({"points":p,"fill":"#585247"},200,mina.linear,featured.remove); }); }); } items.forEach(register);
*{margin:0;padding:0;} body{background:#E3DFD2;} svg{display:block;}
<script src="http://thisisa.simple-url.com/js/snapsvg.js"></script>