Meatspin
package {
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
import flash.utils.getTimer;
public class MeatSpin extends Sprite {
public var meat:Sprite;
public var music:Loader;
public function MeatSpin () {
super ();
meat = new Sprite;
meat.x = 465 / 2;
meat.y = 465 / 2;
addChild (meat);
meat.graphics.lineStyle (2);
meat.graphics.drawRect ( -5, -20 -50, 10, 50);
addEventListener (Event.ENTER_FRAME, loop);
// get the soundtrack playing
music = new Loader;
music.load (new URLRequest ("http://www.meatspin.com/spin_counter.swf"));
}
public function loop (e:Event):void {
var t:Number = 1.5e-2 * getTimer ();
t -= int (t / (2 * Math.PI)) * 2 * Math.PI;
var c:Number = Math.cos (t);
var s:Number = Math.sin (t);
graphics.clear ();
graphics.lineStyle (2);
graphics.drawCircle (465 / 2, 465 / 2, 20);
var xr:Number = 465 / 2 + 20 * s;
var yr:Number = 465 / 2 + 20 * c;
var xp:Number = 465 / 2;
var yp:Number = 465 / 2 + 80 + 30 * c;
graphics.drawRect (xp - 7, yp, 14, 60);
graphics.drawCircle (xp, yp + 85, 25);
graphics.moveTo (xr, yr);
graphics.lineTo (xp, yp);
meat.rotation = -t * 180 / Math.PI;
}
}
}