向心力 9re forked:3favorite:12lines:41license : All rights reserved modified : 2009-07-01 23:40:19 share Tweet package { import flash.display.MovieClip; import flash.display.Shape; import flash.events.Event; import flash.events.TimerEvent; import flash.utils.Timer; /** * This code is illustrated in the following entry. http://level0.kayac.com/2009/07/flashlite11sincos.php * @author 9re */ public class CircularMotion extends MovieClip { private const K:Number = 0.1; private const R:Number = 120; private var _shp:Shape; public function CircularMotion() { _shp = new Shape(); _shp.graphics.beginFill(0); _shp.graphics.drawCircle(0, 0, 15); _shp.graphics.endFill(); _shp.x = stage.stageWidth / 2 + R; _shp.y = stage.stageHeight / 2; graphics.lineStyle(1, 0xff0000); graphics.moveTo(_shp.x, _shp.y); addChild(_shp); addEventListener(Event.ENTER_FRAME, enterFrameHandler); var timer:Timer = new Timer(20000); timer.addEventListener(TimerEvent.TIMER, function (e:TimerEvent):void { graphics.clear(); graphics.lineStyle(1, 0xff0000); graphics.moveTo(_shp.x, _shp.y); }); timer.start(); } private function enterFrameHandler(e:Event):void { _shp.x -= (_shp.y - stage.stageHeight / 2) * K; _shp.y += (_shp.x - stage.stageWidth / 2) * K; graphics.lineTo(_shp.x, _shp.y); } } } Code Fullscreen Preview Fullscreen FlashFit ikusu dizgid gys chimanaco tkinjo takion assen_nissen.. dosken : cossin円運動 nogud : cossinecos,sin使わずに円運どー clockmaker : cos/sinを使わずに円を描く naonya3 : cosを使わずに円運動sin,高速化に使ったり cos cosを使わずに円運動 sin sin, sine を使わずに円運動を近似 円運動 addEventListener Shape TimerEvent.ENTER_FRAME TimerEvent start TimerEvent.TIMER Timer Number sort new page view favorite forked pv103 forked from: 向心力 nora forked:1 favorite:0lines:41 (diff:1) pv276 forked from: 向心力 9re forked:1 favorite:0lines:44 (diff:22) tag: Lissajous curve pv195 forked from: 向心力 XELF forked:0 favorite:0lines:42 (diff:28)