import flash.filters.BlurFilter;
var pNum = 17;
setup();
function setup() {
for (i=1; i<=pNum; i++) {
mc = this.createEmptyMovieClip("s"+i, i);
mc.angle = i*360/pNum;
mc.dx = 400*Math.random();
mc.attachMovie(i+"s","mc"+i,i);
mc.num = i;
mc._alpha = 70;
mc.onRollOver = rollover;
mc.onRollOut = rollout;
mc.onRelease = loadImg;
mc.onEnterFrame = floating;
}
}
function rollover() {
this._alpha = 100;
}
function rollout() {
this._alpha = 70;
}
function floating() {
rad = this.angle*Math.PI/180;
depth = Math.floor((1+Math.cos(rad))*100);
scale = Math.floor((2+Math.cos(rad))*100/3);
drx = (Stage.width/2-_xmouse)/3;
dry = (Stage.height/2-_ymouse)/30;
speed = dry;
this._x = 50+this.dx+drx*Math.cos(rad);
this._y = 180+120*Math.sin(rad);
this.swapDepths(depth);
this._xscale = scale;
this._yscale = scale;
this.v = Math.floor((1-Math.cos(rad))*1.5);
blurChange(this,this.v);
this.angle += speed;
}
function blurChange(this_mc, v) {
var myBlur:BlurFilter = new BlurFilter(v, v, 1);
this_mc.filters = [myBlur];
}
function loadImg() {
for (j=1; j<=pNum; j++) {
_root["s"+j]._visible = false;
}
this._visible = true;
this.loadMovie("img/"+this.num+".jpg");
this._xscale = this._yscale=20;
blurChange(this,0);
this_mc = this;
onEnterFrame = function () {
this_mc._x += (Stage.width/2-250-this_mc._x)/3;
this_mc._y += (10-this_mc._y)/3;
this_mc._xscale += (100-this_mc._xscale)/3;
this_mc._yscale += (100-this_mc._yscale)/3;
this_mc.onRelease = function() {
this_mc.removeMovieClip();
delete onEnterFrame;
refreshing();
/*for (j=1; j<=pNum; j++) {
_root["s"+j]._visible = true;
}*/
};
};
}
reset_btn.onRelease = function() {
refreshing();
};
function refreshing() {
for (i=1; i<=pNum; i++) {
_root["s"+i].removeMovieClip();
}
setup();
} |
ぼかしフィルターのインポート
写真の枚数
初期セットアップ関数
空のムービークリップ作成
各mcに枚数で360°を割った角度の倍数を割当
各mcの初期x座標を0-400の間でランダムに
各mcにサムネイル画像をロード
mcの番号を取得
アルファ値を70に
サムネイルがそれぞれの楕円軌道上で動く関数
mcの角度をラディアンに
深度を100〜0に(手前が100で上部にくる)
scaleを3〜1の100/3倍に(手前が大きい)
マウスのステージ中心からのx方向のずれ
y方向
dryをspeedに
(x,y)を楕円軌道に乗せる
深度の設定
サイズの設定
ぼけ度合いの設定(手前がはっきり)
毎フレームspeedだけ角度を増す
ぼかし関数
拡大写真のロード関数
すべてのサムネイルを非表示に
クリックされたサムネイルだけ表示
mcにクリックされた番号の拡大写真をロード
サイズをサムネイルの大きさに
ぼかしをなくす
毎フレームごとに
拡大写真の左上座標
サイズを100%に
拡大写真のリリースで
拡大写真削除
onEnterFrameの削除
初期状態戻す関数へ
/*から*/までは、refreshing()の代わりに記述すると、拡大表示した写真が非表示になる
リセットボタンがリリースされたら
全てのサムネイルムービークリップを削除
初期設定関数setupへ
|