dist/visualizations/michaelbromley.js
function Polygon( sides, x, y, tileSize, ctx, num, analyser, streamData, tiles, fgRotation ){
	this.analyser = analyser;
	this.sides = sides;
	this.tileSize = tileSize;
	this.ctx = ctx;
	this.tiles = tiles;
	this.fgRotation = fgRotation;

	/*
		The number of the tile, starting at 0
	*/
	this.num = num;
	/*
		The highest colour value, which then fades out
	*/
	this.high = 0;
	/*
		Increase this value to fade out faster.
	*/
	this.decay = this.num > 42 ? 1.5 : 2;
	/* For highlighted stroke effect
		figure out the x and y coordinates of the center of the polygon based on the
		60 degree XY axis coordinates passed in
	*/
	this.highlight = 0;

	var step = Math.round(Math.cos(Math.PI/6)*tileSize*2);
	this.y = Math.round(step * Math.sin(Math.PI/3) * -y  );
	this.x = Math.round(x * step + y * step/2 );

	/*
		Calculate the vertices of the polygon
	*/
	this.vertices = [];
	for (var i = 1; i <= this.sides;i += 1) {

		x = this.x + this.tileSize * Math.cos(i * 2 * Math.PI / this.sides + Math.PI/6);
		y = this.y + this.tileSize * Math.sin(i * 2 * Math.PI / this.sides + Math.PI/6);

		this.vertices.push([x, y]);
	}

	this.streamData = streamData;
}
function Polygon( sides, x, y, tileSize, ctx, num, analyser, streamData, tiles, fgRotation ){
	this.analyser = analyser;
	this.sides = sides;
	this.tileSize = tileSize;
	this.ctx = ctx;
	this.tiles = tiles;
	this.fgRotation = fgRotation;

	/*
		The number of the tile, starting at 0
	*/
	this.num = num;
	/*
		The highest colour value, which then fades out
	*/
	this.high = 0;
	/*
		Increase this value to fade out faster.
	*/
	this.decay = this.num > 42 ? 1.5 : 2;
	/* For highlighted stroke effect
		figure out the x and y coordinates of the center of the polygon based on the
		60 degree XY axis coordinates passed in
	*/
	this.highlight = 0;

	var step = Math.round(Math.cos(Math.PI/6)*tileSize*2);
	this.y = Math.round(step * Math.sin(Math.PI/3) * -y  );
	this.x = Math.round(x * step + y * step/2 );

	/*
		Calculate the vertices of the polygon
	*/
	this.vertices = [];
	for (var i = 1; i <= this.sides;i += 1) {

		x = this.x + this.tileSize * Math.cos(i * 2 * Math.PI / this.sides + Math.PI/6);
		y = this.y + this.tileSize * Math.sin(i * 2 * Math.PI / this.sides + Math.PI/6);

		this.vertices.push([x, y]);
	}

	this.streamData = streamData;
}
function Polygon ( sides , x , y , tileSize , ctx , num , analyser , streamData , tiles , fgRotation ) { this . analyser = analyser ; this . sides = sides ; this . tileSize = tileSize ; this . ctx = ctx ; this . tiles = tiles ; this . fgRotation = fgRotation ; /*
		The number of the tile, starting at 0
	*/ this . num = num ; /*
		The highest colour value, which then fades out
	*/ this . high = 0 ; /*
		Increase this value to fade out faster.
	*/ this . decay = this . num > 42 ? 1.5 : 2 ; /* For highlighted stroke effect
		figure out the x and y coordinates of the center of the polygon based on the
		60 degree XY axis coordinates passed in
	*/ this . highlight = 0 ; var step = Math . round ( Math . cos ( Math . PI / 6 ) * tileSize * 2 ) ; this . y = Math . round ( step * Math . sin ( Math . PI / 3 ) * - y ) ; this . x = Math . round ( x * step + y * step / 2 ) ; /*
		Calculate the vertices of the polygon
	*/ this . vertices = [ ] ; for ( var i = 1 ; i <= this . sides ; i += 1 ) { x = this . x + this . tileSize * Math . cos ( i * 2 * Math . PI / this . sides + Math . PI / 6 ) ; y = this . y + this . tileSize * Math . sin ( i * 2 * Math . PI / this . sides + Math . PI / 6 ) ; this . vertices . push ( [ x , y ] ) ; } this . streamData = streamData ; }
Defines the polygon object.
@param {number} sides
@param {number} x
@param {number} y
@param {number} tileSize
@param {context} ctx
@param {number} num
@param {Uint8Array} streamData
@param {array} tiles
@param {integer} fgRotation
Defines the polygon object .