In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Clock

Get Adobe Flash player
by makc3d 15 Mar 2010
  • Related works: 9
  • Talk

    makc3d at 18 Oct 2014 16:34
    in case anyone ends up here in 2014: http://makc3d.wordpress.com/2010/03/22/wonderfl-clock/

    Tags

    Embed
/**
 * Copyright makc3d ( http://wonderfl.net/user/makc3d )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/u3oC
 */

package  {
	import flash.display.Sprite;
	import flash.events.Event;
	[SWF (width=465, height=465)]
	public class Clock extends Sprite {
		public function Clock () {
			super (); x = y = 465 / 2; rotation = -90;
			addEventListener (Event.ENTER_FRAME, function (e:Event):void {
				var d:Date = new Date;
				var s:Number = d.getSeconds () * 2 * Math.PI / 60;
				var m:Number = d.getMinutes () * 2 * Math.PI / 60;
				var h:Number = d.getHours () * 2 * Math.PI / 12;
				graphics.clear (); graphics.lineStyle (2);
				graphics.lineTo (200 * Math.cos (s), 200 * Math.sin (s)); graphics.moveTo (0, 0);
				graphics.lineTo (150 * Math.cos (m), 150 * Math.sin (m)); graphics.moveTo (0, 0);
				graphics.lineTo (100 * Math.cos (h), 100 * Math.sin (h));
			});
		}
	}
}