Sin and Cosin Wave
♥0 |
Line 22 |
Modified 2010-03-03 04:07:44 |
MIT License
archived:2017-03-20 15:23:12
ActionScript3 source code
/**
* Copyright 883108 ( http://wonderfl.net/user/883108 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/bmDo
*/
package {
import flash.display.Sprite;
import flash.events.Event;
public class Circle extends Sprite {
private var angle:Number = 0;
private var centerX:Number = stage.stageWidth/2;
private var centerY:Number = stage.stageHeight/2;
private var radiusX:Number = 100;
private var radiusY:Number = 50;
private var speed:Number = .4;
public function Circle():void {
graphics.beginFill(0xffffff);
graphics.lineStyle(0, 0xcccccc);
graphics.moveTo(centerX, centerY);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame($event:Event):void{
graphics.lineTo(centerX + Math.sin(angle) * radiusX, centerY + Math.cos(angle) * radiusY);
angle += speed;
}
}
}