//
//
// wavelength = amplitude * periodicFunction(frequency * time + phaseShift)
//
// function that updates the stage
function circleAnimationstep(whichCircle, bounds) {
// bounds[0] = left edge of cell
// bounds[1] = top edge of cell
// bounds[2] = right edge of cell
// bounds[3] = bottom edge of cell
//
var period = 6 * 1000;
var milliseconds = (new Date()).getTime();
var radians = (2* Math.PI) * ((milliseconds % period) / period);
//
var norm = whichCircle / circles.length
var frequency = 5;
var phaseShift = norm * (3* Math.PI);
//
circles[whichCircle]._x = rangedSin(radians, frequency, phaseShift, bounds[0], bounds[2]);
circles[whichCircle]._y = rangedCos(radians, frequency+1, phaseShift, bounds[3], bounds[1]);
circles[whichCircle]._alpha = rangedSin(radians, frequency, phaseShift, 20, 100);
circles[whichCircle]._xscale = rangedSin(radians, frequency, phaseShift, 20, 500);
circles[whichCircle]._yscale = rangedSin(radians, frequency, phaseShift, 20, 500);
}
//
//
//
//
//
//----------------------------------------------------------------------------------
//
// constants:
var numCols =10;
var numRows = 2;
var col = Stage.width / numCols;
var row = Stage.height / numRows;
var circles = new Array(circle01, circle02, circle03, circle04, circle05, circle06, circle07, circle08, circle09, circle10, circle11, circle12, circle13, circle14, circle15, circle16, circle17, circle18, circle19, circle20, circle21, circle22, circle23, circle24, circle25);
//
function updateFrame() {
var curRow = 0;
var curCol = 0;
for (var j = 0; j < circles.length; j++) {
var lo_x = (col * curCol) + (.5 * circles[j]._width);
var hi_x = (col * (curCol + 1)) - (.5 * circles[j]._width);
var lo_y = (row * curRow) + (1* circles[j]._height);
var hi_y = (row * (curRow + 1)) - (1 * circles[j]._height);
//
curCol++;
if (curCol == numCols) {
curRow++;
curCol = 0;
}
//
circleAnimationstep(j, new Array(lo_x, hi_y, hi_x, lo_y));
}
}
//
function rangedSin(t, f, p, lo, hi) {
var a = (hi - lo) * .9;
var mid = lo + a;
return mid + (a * Math.sin(f * t + p));
}
//
function rangedCos(t, f, p, lo, hi) {
var a = (hi - lo) * .3;
var mid = lo + a;
return mid + (a * Math.cos(f * t + p));
}
//
//
// associate a function with the enterFrame event
this.onEnterFrame = updateFrame;
//