タグ :

ランダム運動1 : ActionScript

投稿日 : 2008年2月24日 | 更新日 : 2010年09月15日 前のページへ戻る

ランダムにボールが広がるサンプルを作成しました。 »particlemotion1.swf
function ParticleClip(target) {

	var target = target;

	this.execMotion = function(x, y, n) {
		for (var i = 0; i < n; i++) {
			var container = target.createEmptyMovieClip("container"+i, i);
			var ball = container.attachMovie("ball", "ball", 0);
			container._rotation = Math.random()*360;
			container._x = x;
			container._y = y;
			ball.onEnterFrame = function() {
				// Move the particle over time
				this._y += this.speed;
				this.speed++;
				if (this._y>300) {
					this._y = 0;
					this.speed = Math.random()*10;
					this._yscale = 100;
				}
			};
			ball.speed = Math.random()*10;
		}
	};
}

var obj = new ParticleClip(_root);
obj.execMotion(150, 150, 20);

関連記事

»ランダム運動3 : ActionScript »ランダム運動2-2 : ActionScript »ランダム運動2-1 : ActionScript »ランダム運動1 : ActionScript

ActionScript2.0 | 固定リンク | Comments (0)

関連記事

このページの上へ移動

コメント

コメントはまだありません。

コメントの投稿

改行と段落タグは自動で挿入されます。
メールアドレスは表示されません。

 

 

 


トラックバックURL

http://www.findxfine.com/flash/actionscript/122.html/trackback

このページの上へ