//CyclingOnOffSetup
//Set up a simple animated interaction: click on the sprite and it cycles;
//click again and the sprite stops cycling
var CyclingOnOffSetup = function (setupArgs) {
"use strict";
//setupArgs passes in a reference to the project instantiation of the Main class
if (!setupArgs) {
	setupArgs = {};
}

this.blueRect = {
  spriteProps:{name:'blue rect', x: 600, y: 400, w: 1200, h: 800, fillColor:'#538e06', visible:true}, 
  painters:[new RectPainter()], 
  behaviors:[]
};
this.myBackground = new ShapeLineGraphic(this.blueRect);
  	
  
 this.catSheet = [
	{ x:0, y:0, w:400, h:220 },
	{ x:400, y:0, w:400, h:220 },
	{ x:800, y:0, w:400, h:220 },
	{ x:1200, y:0, w:400, h:220 },
	{ x:1600, y:0, w:400, h:220 },
	
	{ x:0, y:220, w:400, h:220 },
	{ x:400, y:220, w:400, h:220 },
	{ x:800, y:220, w:400, h:220 },
	{ x:1200, y:220, w:400, h:220 },
	{ x:1600, y:220, w:400, h:220 },
	
	{ x:0, y:440, w:400, h:220 },
	{ x:400, y:440, w:400, h:220 },
	{ x:800, y:440, w:400, h:220 },
	{ x:1200, y:440, w:400, h:220 },
	{ x:1600, y:440, w:400, h:220 },
  ];
	
  		  
  this.catAnim = {
	spriteProps:{name:'catAnim', x:180, y:240, w:2000, h:660, cw:400, ch:220, XYscale:[0.5, 0.5], graphics:['img/cat-sprite-sheet.png'], sheets:[this.catSheet], rotation: 0.2, visible:true, mouseIsOver:false}, 
	painters:[new BitmapPainter()], 
	behaviors:[new CyclingOnOff({cycleTime:60})]
  };
  
  this.myCatAnim = new BitmapGraphic(this.catAnim);
  
  this.catAnim1 = {
	spriteProps:{name:'catAnim1', x:410, y:240, w:2000, h:660, cw:400, ch:220, XYscale:[0.5, 0.5], graphics:['img/cat-sprite-sheet.png'], sheets:[this.catSheet], rotation: 0.2, visible:true, mouseIsOver:false},
	painters:[new BitmapPainter()], 
	behaviors:[new RotatingOnOff({cycleTime:60}), new CyclingOnOff({cycleTime:60})]
  };
  
  this.myCatAnim1 = new BitmapGraphic(this.catAnim1);
  
  this.catAnim2 = {
	spriteProps:{name:'catAnim2', x:610, y:240, w:2000, h:660, cw:400, ch:220, XYscale:[0.5, 0.5], graphics:['img/cat-sprite-sheet.png'], sheets:[this.catSheet], rotation: 0.2, visible:true, mouseIsOver:false}, 
	painters:[new BitmapPainter()], 
	behaviors:[new ScalingUpDownRange({scaleMin: 0.5}), new CyclingOnOff({cycleTime:60})]
  };
  
  this.myCatAnim2 = new BitmapGraphic(this.catAnim2);
  
  this.catAnim3 = {
	spriteProps:{name:'catAnim3', x:810, y:240, w:2000, h:660, cw:400, ch:220, XYscale:[0.5, 0.5], alpha: 0.2, graphics:['img/cat-sprite-sheet.png'], sheets:[this.catSheet], rotation: 0.2, visible:true, mouseIsOver:false}, 
	painters:[new BitmapPainter()], 
	behaviors:[new AlphaUpDown(), new CyclingOnOff({cycleTime:60})]
  };
  
  this.myCatAnim3 = new BitmapGraphic(this.catAnim3);
  
  this.catAnim4 = {
	spriteProps:{name:'catAnim4', x:1010, y:240,w:2000, h:660, cw:400, ch:220, vx:200, vy:0, XYscale:[0.5, 0.5], graphics:['img/cat-sprite-sheet.png'], sheets:[this.catSheet], rotation: 0.2, visible:true, mouseIsOver:false}, 
	painters:[new BitmapPainter()], 
	behaviors:[new MovingOnOff(), new CyclingOnOff({cycleTime:60})]
  };
  
  this.myCatAnim4 = new BitmapGraphic(this.catAnim4);
  

  this.sprites = [this.myBackground, this.myCatAnim, this.myCatAnim1, this.myCatAnim2, this.myCatAnim3, this.myCatAnim4];

  return this;		
};


CyclingOnOffSetup.prototype.getSprites = function() {
	"use strict";
	return this.sprites;	
};


