i have this code that makes a random star/blob shape and then every 2000 Interval it should get new points and then re draw it every frame closer and closer to the new points with a (endX-this._x)/speed; like code to smooth the change but as you can see it dose not do that at all. and i don’t really know why. any suggestions/help would be appreciated.
here is the full code (i have it running in a 800x600 movie)
function circle(mc, x:Number, y:Number, rMin:Number, rMax:Number, col:Number, depth:Number, path:MovieClip):Void {
mc = path.createEmptyMovieClip(mc, depth);
mc.lineStyle(0, col);
mc.moveTo(x+((rMax-rMin)*.5+rMin), y);
mc.beginFill(col);
for (d=2; d<(50)+1; d += 2) {
//random()
ang = (random(30)/100)+(7.2*d)/180*Math.PI;
stes = (random(30)/100)+(7.2*(d-1))/180*Math.PI;
max = rMin+random((rMax-rMin)*0.25);
_root[d+"omax"] = max;
sx = x+Math.cos(stes)*max;
sy = y+Math.sin(stes)*max;
mc.lineTo(sx, sy);
min = rMin+random((rMax-rMin)*0.75);
ex = x+Math.cos(ang)*min;
ey = y+Math.sin(ang)*min;
mc.lineTo(ex, ey);
_root[d+"omin"] = min;
//mc.curveTo(sx, sy, ex, ey);
}
endFill();
//setInterval()
intervalId = setInterval(_root, "moveline", 2000);
moveline = function() {
trace("moo")
for (d=2; d<(50)+1; d += 2) {
_root[d+"max"] = rMin+random((rMax-rMin)*0.25);
_root[d+"min"] = rMin+random((rMax-rMin)*0.75);
}
//mc.lineTo(sx, sy)
//mc.lineTo(ex, ey)
onEnterFrame = function () {
//var myTween:Tween = new Tween(this, "_xscale", mx.transitions.easing.Elastic.easeOut, 100, 300, 4, true);
//get ne punts
mc = path.createEmptyMovieClip(mc, depth);
mc.lineStyle(0, col);
mc.moveTo(x+((rMax-rMin)*.5+rMin +random(10)-5), y+random(10)-5);
mc.beginFill(col);
for (d=2; d<(50)+1; d += 2) {
speed = 10;
ang = (random(30)/100)+(7.2*d)/180*Math.PI;
stes = (random(30)/100)+(7.2*(d-1))/180*Math.PI;
//(endX-_x)/speed;
tmax = rMin+((_root[d+"max"]-_root[d+"omax"])/speed);
tmin = rMin+((_root[d+"min"]-_root[d+"omin"])/speed);
sx = x+Math.cos(stes)*tmax;
sy = y+Math.sin(stes)*tmax;
ex = x+Math.cos(ang)*tmin;
ey = y+Math.sin(ang)*tmin;
mc.lineTo(sx, sy);
mc.lineTo(ex, ey);
_root[d+"omax"] = tmax;
_root[d+"omin"] = tmin;
}
endFill();
};
};
}
circle("test", 400, 300, 80, 140, 0x000000, 10, _root);
this is where the problem will be
onEnterFrame = function () {
//get ne punts
mc = path.createEmptyMovieClip(mc, depth);
mc.lineStyle(0, col);
mc.moveTo(x+((rMax-rMin)*.5+rMin +random(10)-5), y+random(10)-5);
mc.beginFill(col);
for (d=2; d<(50)+1; d += 2) {
speed = 10;
//(endX-this._x)/speed;
tmax = rMin+((_root[d+"max"]-_root[d+"omax"])/speed);
tmin = rMin+((_root[d+"min"]-_root[d+"omin"])/speed);
sx = x+Math.cos(_root[d+"stes"])*tmax;
sy = y+Math.sin(_root[d+"stes"])*tmax;
ex = x+Math.cos(_root[d+"ang"])*tmin;
ey = y+Math.sin(_root[d+"ang"])*tmin;
mc.lineTo(sx, sy);
mc.lineTo(ex, ey);
_root[d+"omax"] = tmax;
_root[d+"omin"] = tmin;
}
endFill();
};