var pMaxSize:Number = 150;
var pCenterX:Number = 275;
var pCenterY:Number = 200;
var pNumTraces:Number = 20;
var pNumLayers:Number = 30;
var pCurrentLayer:Number = 0;
var pLineColour:Number;
var pPointDegree:Array = new Array();
var pPointDegreeChange:Array = new Array();
var pPointScale:Array = new Array();
var pPointScaleChange:Array = new Array();
var pPointX:Array = new Array();
var pPointY:Array = new Array();
var pBaseTimeline:MovieClip;
var pIntervalId:Number;
function init(baseTimeline:MovieClip):Void {
pBaseTimeline = baseTimeline;
pBaseTimeline.createEmptyMovieClip("holder", 0);
for (var j:Number = 0; j
pBaseTimeline.createEmptyMovieClip("layer"+j, j+1);
pBaseTimeline["layer"+j]._x = pCenterX;
pBaseTimeline["layer"+j]._y = pCenterY;
}
initTraces();
pBaseTimeline.holder.onEnterFrame = function() {
moveSpheres();
};
pIntervalId = setInterval(this, "updateSeeds", 2000);
}
function initTraces() {
for (var i:Number = 0; i pPointX = 0;
pPointY = 0;
pPointDegree = (6.28318530718/pNumTraces)*i;
pPointScale = 50;
}
updateSeeds();
for (i=0; i plotLine(i);
}
}
function moveSpheres() {
for (var i:Number = 0; i pPointDegree += pPointDegreeChange;
pPointScale += pPointScaleChange;
plotLine(i, true);
}
pBaseTimeline["layer"+pCurrentLayer]._alpha = 100;
pCurrentLayer = (pCurrentLayer+1)%pNumLayers;
for (var j:Number = 0; j pBaseTimeline["layer"+((pCurrentLayer+j)%pNumLayers)]._alpha = (j/pNumLayers)*100;
}
pBaseTimeline["layer"+pCurrentLayer].clear();
}
function plotLine(i:Number, drawLine:Boolean) {
pBaseTimeline["layer"+pCurrentLayer].lineStyle(1, pLineColour, 100);
pBaseTimeline["layer"+pCurrentLayer].moveTo(pPointX, pPointY);
pPointX = (Math.cos(pPointDegree)*pPointScale);
pPointY = (Math.sin(pPointDegree)*pPointScale);
if (drawLine == true) {
pBaseTimeline["layer"+pCurrentLayer].lineTo(pPointX, pPointY);
}
}
function updateSeeds() {
var deg:Number;
var scale:Number;
deg = randomRange(-100, 100)/2000;
if (pPointScale[0]>pMaxSize) {
scale = randomRange(-10, 0)/2;
} else if (pPointScale[0]<-pMaxSize) {
scale = randomRange(0, 10)/2;
} else {
scale = randomRange(-10, 10)/2;
}
for (var i:Number = 0; i pPointDegreeChange = deg;
pPointScaleChange = scale;
}
pLineColour = randomRange(0, 0xFFFFFF);
}
function randomRange(min:Number, max:Number):Number {
var randomNum:Number = Math.round(Math.random()*(max-min))+min;
return randomNum;
}
init(this);
--------------------next---------------------
阅读(269) | 评论(0) | 转发(0) |