とりあえずこれ見る.
んでもって,これ.
1000000人のキャンドルナイト.
動きが似た様なのがたまたまできた.たまたま.
これのクローズアップの動きのメモ.
/**
* アップする際の抵抗率.
* (0 < conflict 1)
*/
this._conflict = 0.2;
/**
* アップする拡大率.
*
* @param Number
*/
var _CLOSE_UP_SCALE = 600;
/**
* 初期位置.
*
* @param Number
*/
var _firstX = this._x;
var _firstY = this._y;
/**
* ターゲットの位置.
*
* @description マップ内の座標.
* @param Number
*/
var _targetX;
var _targetY;
/**
* 特定の位置へターゲットする.
*
* @description
* @return Void
*/
this.target = function() {
this.enabled = false;
// 日本地図でクリックされた座標
var targetX = this._xmouse;
var targetY = this._ymouse;
this.onEnterFrame = function() {
// 拡大率を変更
var spanScale = this._CLOSE_UP_SCALE - this._xscale;
this._xscale = this._yscale += this._conflict * spanScale;
// 位置を変更
var spanX = (Stage.width / 2 - (targetX * (this._xscale / 100))) - this._x;
var spanY = (Stage.height / 2 - (targetY * (this._yscale / 100))) - this._y;
this._x += this._conflict * spanX;
this._y += this._conflict * spanY;
// ターゲットの位置が特定の位置と大きさに変更されたとき
if ( Math.abs(spanScale) < 1 and
Math.abs(spanX) < 1 and
Math.abs(spanY) < 1) {
this._xscale = this._yscale = this._CLOSE_UP_SCALE;
this._x = Stage.width / 2 - clickPoint.x
this._y = Stage.height / 2 - clickPoint.y;
delete this.onEnterFrame;
// onReleaseの機能の置換
this.enabled = true;
this.onRelease = reset;
}
};
};
/**
* 位置を最初の位置・大きさに戻す.
*
* @return Void
*/
this.reset = function() {
this.enabled = false;
this.onEnterFrame = function() {
// 拡大率を変更
var spanScale = 100 - this._xscale;
this._xscale = this._yscale += this._conflict * spanScale;
// 位置を変更
var spanX = (this._firstX * this._xscale / 100) - this._x;
var spanY = (this._firstY * this._yscale / 100) - this._y;
this._x += this._conflict * spanX;
this._y += this._conflict * spanY;
// ターゲットの位置が初期の位置と大きさに変更されたとき
if ( Math.abs(spanScale) < 1 and
Math.abs(spanX) < 1 and
Math.abs(spanY) < 1) {
this._xscale = this._yscale = 100;
this._x = this._firstX;
this._y = this._firstY;
delete this.onEnterFrame;
// onReleaseの機能の置換
this.enabled = true;
this.onRelease = target;
}
};
};
// 初期のonReleaseイベントハンドラの設定
this.onRelease = this.target;
trackback for this entry URL:
http://blog.graffiti-web.org/mt/mt-tb.cgi/317