/*
	This file is part of "Interface Fractures IV - Q".
	Copyright (c) 2016 Luka Prinčič, All rights reserved.
	This program is free software distributed under
	GNU General Public Licence. See COPYING for more info.
	- - - - - - - - - - - - - - - - - - - - - - - - - - - -

  screenClean.pde
    
                                                                             */


// if screenClean is supposed to "clean" the screen
// alpha should always be to the max

void screenClean( float hue,
                  float saturation,
                  float brightness,
                  float alpha,
                  float flickrAmount,
                  float flickrSpeed )
{
  /*
    hue = map(hue, 0, 127, 0, 255);
    saturation = map(saturation, 0, 127, 0, 255);
    brightness = map(brightness, 0, 127, 0, 255);
    alpha = map(alpha, 0, 127, 0, 255);
  */

  flickrAmount = map(flickrAmount, 0, 127, 0, 1);
  flickrSpeed = map(flickrSpeed, 0, 127, 1, 120);

  if ((frameCount % int(flickrSpeed)) == 0) {
    brightness = brightness * flickrAmount;
  }

  //println(frameCount + " " + flickrSpeed + " " + (frameCount % flickrSpeed)); 
  
  colorMode(HSB, 127);
  color c = color(hue, saturation, brightness, alpha);

  fill(c);
  noStroke();
  rectMode(CORNER);
  // rect(0, 0, width * 2, height);
  rect(0, 0, width, height);

}
