fc2ブログ

perlinNoise (3)

2008/02/03 20:07 - AS3.0

(例1)
offset[0].x += 2;  offset[0].y += (-3);
offset[1].x += 2;  offset[1].y += (-3);
offset[2].x += 2;  offset[2].y += (-3);
……

for ( var i:int=0; i<octaves; i++ ) {
 offset[i] = new Point( Math.random()*w , Math.random()*h );
 offxy[i]    = new Array(2);
 offxy[i][0] = Math.random()*dist - dist*0.5;
 offxy[i][1] = Math.random()*dist - dist*0.5;
}
(例2)
offxy = [ [2,-3] , [0,1] , [-1,-3] , ……… ];

for ( var i:int=0; i<octaves; i++ ) {
 offset[i].x += offxy[i][0];
 offset[i].y += offxy[i][1];
}
(例2)の値を使うと、onEnterFrame 時におこなわれる処理は以下のようになります。
(例3)
offset[0].x +=   2 ;  offset[0].y += (-3);
offset[1].x +=   0 ;  offset[1].y +=   1 ;
offset[2].x += (-1);  offset[2].y += (-3);
……





for ( var i:int=0; i<octaves; i++ ) {
 offset[i].x += ( Math.random()*dist - dist*0.5 );
 offset[i].y += ( Math.random()*dist - dist*0.5 );
}


シリーズ

にほんブログ村 IT技術ブログへ

スポンサーサイト




コメントの投稿

非公開コメント

ソースをシェアしていただいてありがとうございます。
2008/02/03 20:33|MobileBMX URL [ 編集 ]

お役に立てたなら何よりです。
2008/02/04 20:46|Aquioux URL [ 編集 ]
タグクラウド

最近の記事
カテゴリ
月別アーカイブ
プロフィール

Aquioux

Author:Aquioux
日曜 Flash プログラマ。
Flash 作品は本館で展示しています。


mailto:aquioux@mail.goo.ne.jp

ブログパーツ

あわせて読みたい

フィードメーター - 閃光的網站・弛緩複合体 -Review Division-


検索/translation
Google



オススメ本

コメント
トラックバック
RSS

Add to Google

Bloglinesで閲読登録

はてなRSSに追加

Subscribe with livedoor Reader

My Yahoo!に追加

Add to Technorati Favorites!

feedpathに追加