钟表单摆

package {
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.display.Shape;

	/*
	      *author : SinSoul 
	      *blogs: http://www.cnblogs.com/sinsoul
	 
	*/
	public class bai extends MovieClip {

		var vx:Number=0;
		var hd:Number=0;

		public function bai() {
			var shape:Shape = new Shape();
			this.addEventListener(Event.ENTER_FRAME,onhandler);
			function onhandler(e) {
				shape.graphics.clear();
				shape.graphics.lineStyle(2,0x000000);
				shape.graphics.moveTo(250,50);
				shape.graphics.lineTo((250+100*Math.sin(hd)),Math.sqrt(200*200-((250+100*Math.sin(hd))-250)*((250+100*Math.sin(hd))-250)));
				addChild(shape);
				shape.graphics.beginFill(0x000000);
				shape.graphics.drawCircle((250+100*Math.sin(hd)),Math.sqrt(200*200-((250+100*Math.sin(hd))-250)*((250+100*Math.sin(hd))-250)),20);
				shape.graphics.endFill();
				addChild(shape);
				hd+=0.1;
			}
		}

	}
}

原文地址:https://www.cnblogs.com/sinsoul/p/1869287.html