⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 animation.js

📁 struts hibernet spring
💻 JS
📖 第 1 页 / 共 2 页
字号:
		// gotoEnd: If true, the animation will end.		clearTimeout(this._timer);		var step = this._percent / 100;		if(gotoEnd){			step = 1;		}		var value = this.curve.getValue(step);		this.fire("handler", ["stop", value]);		this.fire("onStop", [value]);		this._active = false;		this._paused = false;		return this; // dojo.lfx.Animation	},	status: function(){		// summary: Returns a string representation of the status of		//			the animation.		if(this._active){			return this._paused ? "paused" : "playing"; // String		}else{			return "stopped"; // String		}		return this;	},	// "private" methods	_cycle: function(){		clearTimeout(this._timer);		if(this._active){			var curr = new Date().valueOf();			var step = (curr - this._startTime) / (this._endTime - this._startTime);			if(step >= 1){				step = 1;				this._percent = 100;			}else{				this._percent = step * 100;			}						// Perform easing			if((this.easing)&&(dojo.lang.isFunction(this.easing))){				step = this.easing(step);			}			var value = this.curve.getValue(step);			this.fire("handler", ["animate", value]);			this.fire("onAnimate", [value]);			if( step < 1 ){				this._timer = setTimeout(dojo.lang.hitch(this, "_cycle"), this.rate);			}else{				this._active = false;				this.fire("handler", ["end"]);				this.fire("onEnd");				if(this.repeatCount > 0){					this.repeatCount--;					this.play(null, true);				}else if(this.repeatCount == -1){					this.play(null, true);				}else{					if(this._startRepeatCount){						this.repeatCount = this._startRepeatCount;						this._startRepeatCount = 0;					}				}			}		}		return this; // dojo.lfx.Animation	}});dojo.lfx.Combine = function(/*dojo.lfx.IAnimation...*/ animations){	// summary: An animation object to play animations passed to it at the same time.	dojo.lfx.IAnimation.call(this);	this._anims = [];	this._animsEnded = 0;		var anims = arguments;	if(anims.length == 1 && (dojo.lang.isArray(anims[0]) || dojo.lang.isArrayLike(anims[0]))){		/* animations: dojo.lfx.IAnimation[]		   pId: a */		anims = anims[0];	}		dojo.lang.forEach(anims, function(anim){		this._anims.push(anim);		anim.connect("onEnd", dojo.lang.hitch(this, "_onAnimsEnded"));	}, this);}dojo.inherits(dojo.lfx.Combine, dojo.lfx.IAnimation);dojo.lang.extend(dojo.lfx.Combine, {	// private members	_animsEnded: 0,		// public methods	play: function(/*int?*/ delay, /*bool?*/ gotoStart){		// summary: Start the animations.		// delay: How many milliseconds to delay before starting.		// gotoStart: If true, starts the animations from the beginning; otherwise,		//            starts them from their current position.		if( !this._anims.length ){ return this; /*dojo.lfx.Combine*/}		this.fire("beforeBegin");		if(delay > 0){			setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay);			return this; // dojo.lfx.Combine		}				if(gotoStart || this._anims[0].percent == 0){			this.fire("onBegin");		}		this.fire("onPlay");		this._animsCall("play", null, gotoStart);		return this; // dojo.lfx.Combine	},		pause: function(){		// summary: Pauses the running animations.		this.fire("onPause");		this._animsCall("pause"); 		return this; // dojo.lfx.Combine	},		stop: function(/*bool?*/ gotoEnd){		// summary: Stops the running animations.		// gotoEnd: If true, the animations will end.		this.fire("onStop");		this._animsCall("stop", gotoEnd);		return this; // dojo.lfx.Combine	},		// private methods	_onAnimsEnded: function(){		this._animsEnded++;		if(this._animsEnded >= this._anims.length){			this.fire("onEnd");		}		return this; // dojo.lfx.Combine	},		_animsCall: function(/*String*/ funcName){		var args = [];		if(arguments.length > 1){			for(var i = 1 ; i < arguments.length ; i++){				args.push(arguments[i]);			}		}		var _this = this;		dojo.lang.forEach(this._anims, function(anim){			anim[funcName](args);		}, _this);		return this; // dojo.lfx.Combine	}});dojo.lfx.Chain = function(/*dojo.lfx.IAnimation...*/ animations) {	// summary: An animation object to play animations passed to it	//			one after another.	dojo.lfx.IAnimation.call(this);	this._anims = [];	this._currAnim = -1;		var anims = arguments;	if(anims.length == 1 && (dojo.lang.isArray(anims[0]) || dojo.lang.isArrayLike(anims[0]))){		/* animations: dojo.lfx.IAnimation[]		   pId: a */		anims = anims[0];	}		var _this = this;	dojo.lang.forEach(anims, function(anim, i, anims_arr){		this._anims.push(anim);		if(i < anims_arr.length - 1){			anim.connect("onEnd", dojo.lang.hitch(this, "_playNext") );		}else{			anim.connect("onEnd", dojo.lang.hitch(this, function(){ this.fire("onEnd"); }) );		}	}, this);}dojo.inherits(dojo.lfx.Chain, dojo.lfx.IAnimation);dojo.lang.extend(dojo.lfx.Chain, {	// private members	_currAnim: -1,		// public methods	play: function(/*int?*/ delay, /*bool?*/ gotoStart){		// summary: Start the animation sequence.		// delay: How many milliseconds to delay before starting.		// gotoStart: If true, starts the sequence from the beginning; otherwise,		//            starts it from its current position.		if( !this._anims.length ) { return this; /*dojo.lfx.Chain*/}		if( gotoStart || !this._anims[this._currAnim] ) {			this._currAnim = 0;		}		var currentAnimation = this._anims[this._currAnim];		this.fire("beforeBegin");		if(delay > 0){			setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay);			return this; // dojo.lfx.Chain		}				if(currentAnimation){			if(this._currAnim == 0){				this.fire("handler", ["begin", this._currAnim]);				this.fire("onBegin", [this._currAnim]);			}			this.fire("onPlay", [this._currAnim]);			currentAnimation.play(null, gotoStart);		}		return this; // dojo.lfx.Chain	},		pause: function(){		// summary: Pauses the running animation sequence.		if( this._anims[this._currAnim] ) {			this._anims[this._currAnim].pause();			this.fire("onPause", [this._currAnim]);		}		return this; // dojo.lfx.Chain	},		playPause: function(){		// summary: If the animation sequence is playing, pause it; otherwise,		//			play it.		if(this._anims.length == 0){ return this; }		if(this._currAnim == -1){ this._currAnim = 0; }		var currAnim = this._anims[this._currAnim];		if( currAnim ) {			if( !currAnim._active || currAnim._paused ) {				this.play();			} else {				this.pause();			}		}		return this; // dojo.lfx.Chain	},		stop: function(){		// summary: Stops the running animations.		var currAnim = this._anims[this._currAnim];		if(currAnim){			currAnim.stop();			this.fire("onStop", [this._currAnim]);		}		return currAnim; // dojo.lfx.IAnimation	},		// private methods	_playNext: function(){		if( this._currAnim == -1 || this._anims.length == 0 ) { return this; }		this._currAnim++;		if( this._anims[this._currAnim] ){			this._anims[this._currAnim].play(null, true);		}		return this; // dojo.lfx.Chain	}});dojo.lfx.combine = function(/*dojo.lfx.IAnimation...*/ animations){	// summary: Convenience function.  Returns a dojo.lfx.Combine created	//			using the animations passed in.	var anims = arguments;	if(dojo.lang.isArray(arguments[0])){		/* animations: dojo.lfx.IAnimation[]		   pId: a */		anims = arguments[0];	}	if(anims.length == 1){ return anims[0]; }	return new dojo.lfx.Combine(anims); // dojo.lfx.Combine}dojo.lfx.chain = function(/*dojo.lfx.IAnimation...*/ animations){	// summary: Convenience function.  Returns a dojo.lfx.Chain created	//			using the animations passed in.	var anims = arguments;	if(dojo.lang.isArray(arguments[0])){		/* animations: dojo.lfx.IAnimation[]		   pId: a */		anims = arguments[0];	}	if(anims.length == 1){ return anims[0]; }	return new dojo.lfx.Chain(anims); // dojo.lfx.Combine}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -