
// main_init function

main_init = function(mc){
 angle = 0;
 deg = deg360 / 360;
 sf = 100 / Math.sin(deg45);
 mr = []; for (i=0;i<motion.length;i++) mr[i]=motion[i]*deg;
 if (flip_motion % 2) mr[1] += deg180;
 if (flip_motion > 1) mr[3] += deg180;
 mr[4] = scaling % 2 ? deg45 : deg135; 
 mr[5] = scaling > 2 ? deg90 : 0;
}

// main_effect function

main_effect = function(mc,frame){
 if (subs_done) end_effect = true;
}

// sub_init function

sub_init = function(mc){
 if (!out_effect) mc._alpha = 0;
}

// sub_effect function

sub_effect = function(mc,frame){
 perc = frame / lastsubframe;
 if (out_effect) perc = 1 - perc;
 mc._x = mc.__x - Math.cos(perc * mr[0] + mr[1] + angle * deg) * max_radius * (1-perc);
 mc._y = mc.__y - Math.sin(perc * mr[2] + mr[3] + angle * deg) * max_radius * (1-perc);
 if (scaling) mc._xscale = mc._yscale = Math.sin(perc * mr[4] + mr[5]) * sf;
 mc._alpha = fade ? Math.sin(perc * deg90) * 100 : 100;
 if (use_center){ mc._x *= perc; mc._y *= perc; }
 if (frame == lastsubframe) mc.done=true;
}
