ランダム運動1 : ActionScript

Pocket

ランダムにボールが広がるサンプルを作成しました。
»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

コメント

No comments yet.

コメントの投稿

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