ricoanimation.js

来自「外买系统struts2」· JavaScript 代码 · 共 36 行

JS
36
字号
Rico.Effect.Animation = Class.create();Rico.Effect.Animation.prototype = {	initialize : function(duration, steps, options) {		this.duration = duration;		this.stepsLeft = steps;		this.options = options		this.animateMethod = this.animate.bind(this);		this.start();	},		start: function() {		this.animate();	},		animate: function() {     if (this.stepsLeft <=0) {	 			if (this.options.onFinish)				 	this.options.onFinish();        return;     }     if (this.timer)        clearTimeout(this.timer);     this.options.step(this.stepsLeft);			this.startNextStep();  },  	startNextStep: function() {		var stepDuration = Math.round(this.duration/this.stepsLeft) ;    this.duration -= stepDuration;    this.stepsLeft--;    this.timer = setTimeout(this.animateMethod, stepDuration);	}}

⌨️ 快捷键说明

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