{"size": 2570, "ext": "js", "max_stars_repo_path": "public/js/auksalaq/NomadsDisplayClientAnimation.js", "max_stars_repo_name": "nomads2/new-nomads", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/js/auksalaq/NomadsDisplayClientAnimation.js", "max_issues_repo_name": "nomads2/new-nomads", "max_issues_repo_issues_event_min_datetime": "2019-11-02T04:15:13.000Z", "max_issues_repo_issues_event_max_datetime": "2020-07-07T19:16:15.000Z", "max_forks_repo_path": "public/js/auksalaq/NomadsDisplayClientAnimation.js", "max_forks_repo_name": "nomads2/new-nomads", "max_forks_repo_forks_event_min_datetime": "2018-03-14T20:23:38.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-14T20:23:38.000Z"}
{"max_stars_count": null, "max_issues_count": 3, "max_forks_count": 1, "avg_line_length": 22.7433628319, "max_line_length": 73, "alphanum_fraction": 0.5968871595}
// This class is made from animation code genereated by Adobe Illustrator

//Constructor
function NomadsMobileClientAnimation() {
  var canvas = document.getElementById('mainui');
  var ctx = canvas.getContext('2d');
  var fps = 20.0;
  var pointerX = 100;
  var pointerY = 100;
  var drawPointer = false;

  console.log('animation started');

  init = function(){

    // Set main canvas and context references
    canvas = document.getElementById('mainui');
    ctx = canvas.getContext('2d');
    // Set animation timer
    setInterval(drawFrame, (1000 / fps));
  }      

  updateAnimations = function() {
    // Update animation clocks
    //updateAllClocks();
  }

  drawFrame = function() {

    // Update animations
    updateAnimations();

    // Clear canvas
    ctx.clearRect(0, 0, canvas.width, canvas.height);

    draw(ctx);


    // Add dynamic objects from users (text)
    // has to be in this draw loop, otherwise won't display
    // display User Text objects that get deleted after X time.
    // allClientThoughts[]
    var font = "22px Futura, sans-serif";
    ctx.font = font;
    ctx.fillStyle = "white";
    allClientThoughts.forEach( function (arrayItem, i)
    {
      //change text properties (size, fade out).
      font = arrayItem.size + "px Futura, sans-serif";
      ctx.font = font;
      arrayItem.size += .5;
      ctx.fillStyle = "rgba(255, 255, 255, " + arrayItem.alpha + ")";
      arrayItem.alpha -= 0.005;

      //show text
      ctx.fillText(arrayItem.thought, arrayItem.x*2, arrayItem.y*2);

      //life to delete from array
      arrayItem.life -= 0.05; //2 second life at 20fps
      arrayItem.y -= arrayItem.vectorY;
      if(arrayItem.life <= 0.0){
        if (i > -1) {
            allClientThoughts.splice(i, 1);
        }
      }
    });

    if(drawPointer){

      allClientXY.forEach( function (arrayItem, i)
      {

        ctx.beginPath();
        ctx.arc(arrayItem.x*2,arrayItem.y*2,5,0,2*Math.PI);
        ctx.fillStyle = "rgba(204, 204, 204, 1)";
        ctx.fill();
        ctx.strokeStyle = '#999';
        ctx.stroke();
      
      });
    }
  }



  draw = function(ctx) {

    // layer1/Linked File
    ctx.save();
    //ctx.transform(1.000, 0.000, -0.000, 1.000, 303.4, 315.5);
    var background = document.getElementById('background');  
    ctx.drawImage(background, 0, 0);
    ctx.restore();
  }

  this.xyOn = function() {
    drawPointer = true;
  }

  this.xyOff = function() {
    drawPointer = false;
  }

  this.xyMove = function(x, y) {
    pointerX = x;
    pointerY = y;
  }

  init();

}

