Hi everybody,
I have the code below, creating movements and changes of alpha values of three mc.
When I test the animation sometimes the animation is smooth, sometimes it isn’t. Is there anything wrong with this code?
Thanks a lot
mc3._alpha = 0;
//
function fvmoving() {
mc1._xscale += (50 - mc1._xscale) * 0.3;
mc1._yscale += (50 - mc1._yscale) * 0.3;
mc1._y += (300 - mc1._y) * 0.3;
if (mc1._xscale > 50 - 1 && mc1._xscale < 50 + 1 && mc1._yscale > 50 - 1 && mc1._yscale < 50 + 1 && mc1._y > 300 - 1 && mc1._y < 300 + 1) {
mc1._xscale = 50;
mc1._yscale = 50;
mc1._y = 300;
mc2._xscale += (50 - mc2._xscale) * 0.3;
mc2._yscale += (50 - mc2._yscale) * 0.3;
if (mc2._xscale > 50 - 1 && mc2._xscale < 50 + 1 && mc2._yscale > 50 - 1 && mc2._yscale < 50 + 1) {
mc2._xscale = 50;
mc2._yscale = 50;
mc3._alpha += (100 - mc3._alpha) * 0.3;
if (mc3._alpha > 100 - 1 && mc3._alpha < 100 + 1) {
mc3._alpha = 100;
clearInterval(fvmov);
}
}
}
updateAfterEvent();
}
//
var fvmov = setInterval(fvmoving, 50);