Chaos Game
Nやwtの値を変えると違う模様ができる。
本当は点の数を増やしたいのだが、すごく時間がかかるので増やせない。
描画方法がいけないのだろうけど、どうすればいいのかまだわかりません。
♥0 |
Line 24 |
Modified 2009-11-26 22:42:20 |
MIT License
archived:2017-03-20 03:47:30
ActionScript3 source code
/**
* Copyright takuya1021 ( http://wonderfl.net/user/takuya1021 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/cQqT
*/
//Nやwtの値を変えると違う模様ができる。
//本当は点の数を増やしたいのだが、すごく時間がかかるので増やせない。
//描画方法がいけないのだろうけど、どうすればいいのかまだわかりません。
package {
import flash.display.Sprite;
import flash.display.StageScaleMode;
import flash.text.TextField;
[SWF(width="400",height="400",backgroundColor="#ffffff")]
public class ChaosGame extends Sprite {
private const N:Number = 3;
private const wt:Number = 0.5;
public function ChaosGame() {
// write as3 code here..
var x:Number = 1;
var y:Number = 0;
for(var i:int = 0;i<5000;i++){
var a:int = Math.random()*N >> 0;
var vx:Number = Math.cos(a*2*Math.PI/N);
var vy:Number = Math.sin(a*2*Math.PI/N);
x = x + (vx - x) * wt;
y = y + (vy - y) * wt;
graphics.beginFill(0x000000);
graphics.drawCircle(x*200+200,y*200+200,1);
graphics.endFill();
}
}
}
}