// Default Values
var transform = {
  translateX: 100, // %
  rotateX: 0, // deg
  rotateY: 0, // deg
  rotateZ: 0, // deg
}

var block = {
  length: 10
}

// Create
var create = function() {
  var blocks = '<div>';

  for(var i = 1; i < block.length -1; i++) {
    blocks += '<div>';
  }
  blocks += '<div class="last">';

  $('.grid-3d').append(blocks);
}

// Add
$('.tool__add').on('click', function() {
  var $last = $('.grid-3d .last');

  $last.append('<div>');
  $last.removeClass('last');
  $last.find('div').addClass('last');

  transformGrid();

});

create();

// Define Default Values;
$('.tools__input-rotateX').val(transform.rotateX);
$('.tools__input-rotateY').val(transform.rotateX);
$('.tools__input-rotateZ').val(transform.rotateX);

$('.tools__input-rotateX').on('input', function(){
  $('.tools__input-rotateX').val($(this).val());
  transform.rotateX = $(this).val();
  transformGrid();
})

$('.tools__input-rotateY').on('input', function(){
  $('.tools__input-rotateY').val($(this).val());
  transform.rotateY = $(this).val();
  transformGrid();
})

$('.tools__input-rotateZ').on('input', function(){
  $('.tools__input-rotateZ').val($(this).val());
  transform.rotateZ = $(this).val();
  transformGrid();
})

transformGrid();

function transformGrid() {
  $('.grid-3d div').css( 'transform',
    'translateX(' + transform.translateX + '%)' +
    'rotateX(' + transform.rotateX + 'deg)' +
    'rotateY(' + transform.rotateY + 'deg)' +
    'rotateZ(' + transform.rotateZ + 'deg)'
  );
}

@@ -143,18 +143,17 @@
 length: 
-10
+3
 %0A%7D%0A%0A// C
@@ -200,21 +200,16 @@
 ocks = '
-%3Cdiv%3E
 ';%0A%0A  fo
@@ -268,16 +268,26 @@
 += '%3Cdiv
+ class=%22b%22
 %3E';%0A  %7D%0A
@@ -311,16 +311,21 @@
  class=%22
+b b--
 last%22%3E';
@@ -405,24 +405,86 @@
 unction() %7B%0A
+  var elem = $('.grid-3d .b--last');%0A%0A  if( elem.length ) %7B%0A  
   var $last 
@@ -498,23 +498,72 @@
 rid-3d .
+b--
 last');
+%0A  %7D else %7B%0A    var $last = $('.grid-3d');%0A  %7D
 %0A%0A  $las
@@ -576,16 +576,34 @@
 nd('%3Cdiv
+ class=%22b b--last%22
 %3E');%0A  $
@@ -620,24 +620,27 @@
 eClass('
+b--
 last');%0A
   $last.
@@ -635,25 +635,144 @@
 ');%0A
+%0A
   
-$last.find('div
+transformGrid();%0A%7D);%0A%0A// Remove%0A$('.tool__remove').on('click', function() %7B%0A  var $last = $('.grid-3d .b--last');%0A%0A  $last.parent('.b
 ').a
@@ -780,24 +780,27 @@
 dClass('
+b--
 last');%0A
 %0A  trans
@@ -795,32 +795,28 @@
 ');%0A
-%0A
   
-transformGrid
+$last.remove
 ();%0A
-%0A
 %7D)
-;
 %0A%0Acr

remove block function