Motion Rings May 3, 2007 at 1:13 pm

Things look so much better with math:

>> Motion Rings

Behind the scenes:

onEnterFrame = function() {

var p:Number = 51;
while(p>0) {
p–;
obj_array[p].x = 250 + 90 * Math.sin(zIndex + 0.1257 * p);
obj_array[p].y = 100 + 90 * Math.cos(zIndex + 0.1257 * p);
bmp.setPixel32( obj_array[p].x , obj_array[p].y , 0xffffffff );
}

var p:Number = 101;
while(p>51) {
p–;
obj_array[p].y = 100 + 90*Math.cos(0.1257*p)*Math.sin(zIndex);
bmp.setPixel32( obj_array[p].x , obj_array[p].y , 0xffffffff );
}

var p:Number = 151;
while(p>101) {
p–;
obj_array[p].x = 250 + 90*Math.sin(0.1257*p)*Math.sin(zIndex);
bmp.setPixel32( obj_array[p].x , obj_array[p].y , 0xffffffff );

}

zIndex = zIndex - 0.02;
}

Leave a Reply