function toast (message, color = 'green', duration = 2000) {
  var toastEl = document.createElement('div');
  var animationDuration = 300;

  toastEl.className = 'toast';
  if (color == 'red') {
    toastEl.className += ' red';
  }

  toastEl.innerText = message;
  toastBox.appendChild(toastEl);

  //////// Animate it! (Anime.JS)
  var animation = anime({
    targets: '.toast',
    opacity: [
      {value: 1, duration: animationDuration},
      {value: 0, delay: animationDuration +  duration, duration: animationDuration}
    ],
    easing: 'easeInOutQuint',
    complete: function() {
      toastBox.removeChild(toastEl);
    }
  });
}
// if we want message has green color, we don't have pass 'red' in toast function

if we want message has green color, we don't have pass 'red' in toast function
if we want message has green color we don ' t have pass ' red ' in toast function
function toast (message, color = 'green', duration = 2000) {
  var toastEl = document.createElement('div');
  var animationDuration = 300;
  toastEl.className = 'toast';
  if (color == 'red') {
    toastEl.className += ' red';
  }
  toastEl.innerText = message;
  toastBox.appendChild(toastEl);
  var animation = anime({
    targets: '.toast',
    opacity: [
      {value: 1, duration: animationDuration},
      {value: 0, delay: animationDuration +  duration, duration: animationDuration}
    ],
    easing: 'easeInOutQuint',
    complete: function() {
      toastBox.removeChild(toastEl);
    }
  });
}
function toast ( message , color = 'green' , duration = 2000 ) { var toastEl = document . createElement ( 'div' ) ; var animationDuration = 300 ; toastEl . className = 'toast' ; if ( color == 'red' ) { toastEl . className += ' red' ; } toastEl . innerText = message ; toastBox . appendChild ( toastEl ) ; var animation = anime ( { targets : '.toast' , opacity : [ { value : 1 , duration : animationDuration } , { value : 0 , delay : animationDuration + duration , duration : animationDuration } ] , easing : 'easeInOutQuint' , complete : function ( ) { toastBox . removeChild ( toastEl ) ; } } ) ; }
if we want message has green color, we don't have pass 'red' in toast function
if we want message has green color we don ' t have pass ' red ' in toast function
//////// Animate it! (Anime.JS)
