flash on 2010-5-13
...
@author ue
♥0 |
Line 35 |
Modified 2010-05-13 12:24:36 |
MIT License
archived:2017-03-20 02:03:52
ActionScript3 source code
/**
* Copyright _ueueueueue ( http://wonderfl.net/user/_ueueueueue )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/u1hU
*/
package
{
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
import flash.ui.*;
[SWF(backgroundColor=0xFFFFFF,frameRate=60)]
/**
* ...
* @author ue
*/
public class Main extends Sprite
{
private var ball:Sprite;
private var angle:Number = 0;
private var radius:Number = 150;
private var value:Number = 1.5;
public function Main():void
{
ball = new Sprite();
ball.graphics.beginFill(0x0);
ball.graphics.drawCircle(0, 0, 5);
ball.x = stage.stageWidth / 2;
ball.y = stage.stageHeight / 2;
addChild(ball);
graphics.lineStyle(0, 0x0, .2);
graphics.moveTo(ball.x, ball.y);
addEventListener(Event.ENTER_FRAME, update);
}
private function update(e:Event):void
{
angle += .05;
ball.x = (Math.sin(angle)* Math.sin(angle * value)) * radius + stage.stageWidth / 2;
ball.y = (Math.sin(angle / value) * Math.sin(angle)) * radius + stage.stageHeight / 2;
graphics.lineTo(ball.x, ball.y);
}
}
}