dist/imgGlitch.js
function imgGlitch(img, options) {
		var imgElement = 'string' === typeof img ? document.querySelector(img) : img;

		if (!(imgElement instanceof HTMLImageElement && imgElement.constructor === HTMLImageElement)) {
			throw new TypeError('renderImgCorruption expects input img to be a valid image element');
		}

		var corrupt64 = getCorrupt64(options);
		var data = imgElement.src;

		var corruption = undefined;

		return {
			start: start,
			stop: stop,
			clear: clear
		};

		/**
   * Start rendering the
   * corruption
   *
   */
		function start() {
			corruption = requestAnimationFrame(render);
		}

		/**
   * Render the corruption
   *
   */
		function render() {
			imgElement.src = corrupt64(data);
			start();
		}

		/**
   * Stop rendering the
   * corruption
   *
   */
		function stop() {
			cancelAnimationFrame(corruption);
		}

		/**
   * Stop rendering the
   * corruption and
   * clear its effects
   *
   */
		function clear() {
			stop();
			imgElement.src = data;
		}
	}
function imgGlitch(img, options) {
		var imgElement = 'string' === typeof img ? document.querySelector(img) : img;

		if (!(imgElement instanceof HTMLImageElement && imgElement.constructor === HTMLImageElement)) {
			throw new TypeError('renderImgCorruption expects input img to be a valid image element');
		}

		var corrupt64 = getCorrupt64(options);
		var data = imgElement.src;

		var corruption = undefined;

		return {
			start: start,
			stop: stop,
			clear: clear
		};

		/**
   * Start rendering the
   * corruption
   *
   */
		function start() {
			corruption = requestAnimationFrame(render);
		}

		/**
   * Render the corruption
   *
   */
		function render() {
			imgElement.src = corrupt64(data);
			start();
		}

		/**
   * Stop rendering the
   * corruption
   *
   */
		function stop() {
			cancelAnimationFrame(corruption);
		}

		/**
   * Stop rendering the
   * corruption and
   * clear its effects
   *
   */
		function clear() {
			stop();
			imgElement.src = data;
		}
	}
function imgGlitch ( img , options ) { var imgElement = 'string' === typeof img ? document . querySelector ( img ) : img ; if ( ! ( imgElement instanceof HTMLImageElement && imgElement . constructor === HTMLImageElement ) ) { throw new TypeError ( 'renderImgCorruption expects input img to be a valid image element' ) ; } var corrupt64 = getCorrupt64 ( options ) ; var data = imgElement . src ; var corruption = undefined ; return { start : start , stop : stop , clear : clear } ; /**
   * Start rendering the
   * corruption
   *
   */ function start ( ) { corruption = requestAnimationFrame ( render ) ; } /**
   * Render the corruption
   *
   */ function render ( ) { imgElement . src = corrupt64 ( data ) ; start ( ) ; } /**
   * Stop rendering the
   * corruption
   *
   */ function stop ( ) { cancelAnimationFrame ( corruption ) ; } /**
   * Stop rendering the
   * corruption and
   * clear its effects
   *
   */ function clear ( ) { stop ( ) ; imgElement . src = data ; } }
Render the base64 corruption
based image glitch effect

@param img
@param options

@returns {{start, stop, clear}}
Render the base64 corruption based image glitch effect