ランダム運動2-1 : ActionScript
ActionScriptでランダムにボールが落下するサンプルを作成しました。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);
var ball = container.attachMovie("ball", "ball", 0);
container._x = Math.random()*300;
container._rotation = Math.random()*2;
container._y = 0;
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+5;
this._yscale = 100;
}
};
ball.speed = Math.random()*10;
}
};
}
var obj = new ParticleClip(_root);
obj.execMotion(0, 100);
»ランダム運動3 : ActionScript
»ランダム運動2-2 : ActionScript
»ランダム運動2-1 : ActionScript
»ランダム運動1 : ActionScript
関連記事
- ランダム運動1 : ActionScript
- ランダム運動2-2 : ActionScript
- ランダム運動3 : ActionScript
- Math.random,Math.ceil : Javascript, Actionscript
- 放射 : ActionScript
コメント
コメントはまだありません。
現在、コメントフォームは閉鎖中です。
トラックバックURL
http://www.findxfine.com/flash/actionscript/127.html/trackback