ランダム運動2-2 : ActionScript

Pocket

前回(ランダム運動2-1)と同じスクリプトです。落下するボールを0と1の数字にしています。

function ParticleClip(target) {

	var target = target;

	this.execMotion = function(x, n) {
		for (var i = 0; i < n; i++){
			var container = target.createEmptyMovieClip("container"+i, i);
			if((i % 2)==0){
				var clip = container.attachMovie("zero", "clip", 0);
			}
			else {
				var clip = container.attachMovie("one", "clip", 0);
			}
			container._x = Math.random()*300;
			container._rotation = Math.random()*2;
			container._y = -100;
			clip.onEnterFrame = function() {
				// Move the particle over time
				this._y += this.speed;
				this.speed++;
				if (this._y>400) {
					this._y = 0;
					this.speed = Math.random()*10+5;
					this._yscale = 100;
				}
			};
			clip.speed = Math.random()*10;
		}
	};
}

var obj = new ParticleClip(_root);
obj.execMotion(0, 100);

関連記事

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

コメント


  1. I’m impresesd. You’ve really raised the bar with that.

    コメント by Rosa — 2011-12-14 @ 5:39 PM

コメントの投稿

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