http://www.gunongxy.com/asp/main.swf
max_scale = 130; //定义最大缩放值
min_scale = 50; //定义最小缩放值
max_alpha = 100; //定义最大透明度(这里是不透明)
min_alpha = 50; //定义最小透明度(这里为半透明效果)
speed = 3; //定义步长
function getDistance () {
var distance = 0; //定义变量distance,值为0
var constant = 1.3; //定义变量constant,值为1.3(注意:值保持不变)
distance = Math.abs(this._y-_parent._ymouse); //计算distance的值,进行重新赋值,现在的distance的值为Math.abs(this._y-_parent._ymouse)的结果而不是零,其中Math.abs()这个函数是求绝对值,this._y-_parent._ymouse的结果是Y坐标轴的缩放值
return distance*constant; //返回函数值,也就是说现在的getDistance= distance*constant
}
function setScale () { //函数开始
var distance = getDistance(); //定义变量distance,其值为getDistance函数的值,也就是distance*constant的计算结果
var target_scale = max_scale-distance; //定义目标缩放大小,并赋值,其中max_scale已经在程序头定义
if (target_scale //如果目标缩放大小的值小于最小缩放值,那么
target_scale = min_scale; 目标缩放大小就等于最小缩放值,min_scale已经在程序头定义
}
var next_scale = this._xscale+((target_scale-this._xscale)/speed); //计算实际缩放的大小
return next_scale; //返回函数值
}
function setAlpha () //这里与上一个函数功能类同
{
var distance = getDistance();
var target_alpha = max_alpha-distance;
if (target_alpha
{
target_alpha = min_alpha;
}
var next_alpha = this._alpha+((target_alpha-this._alpha)/speed);
return next_alpha;
}
function fluidSystem ()
{
var next_scale = setScale(); //这里调用前面的函数给变量赋值
var next_alpha = setAlpha();
this._xscale = next_scale; //定义剪辑的缩放大小
this._yscale = next_scale;
this._alpha = next_alpha; //定义剪辑的透明度
}
this._xscale = min_scale; //这里应该是影片剪辑回到初始的设置状态
this._yscale = min_scale;
this._alpha = min_alpha;