Subversion Repositories Applications.papyrus

Rev

Rev 1318 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1318 Rev 1422
1
/*
1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
3
	All Rights Reserved.
4
 
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
9
*/
-
 
10
 
-
 
11
 
10
 
12
 
11
dojo.provide("dojo.lfx.Animation");
13
dojo.provide("dojo.lfx.Animation");
12
dojo.require("dojo.lang.func");
14
dojo.require("dojo.lang.func");
13
dojo.lfx.Line = function (start, end) {
15
dojo.lfx.Line = function (start, end) {
14
	this.start = start;
16
	this.start = start;
15
	this.end = end;
17
	this.end = end;
16
	if (dojo.lang.isArray(start)) {
18
	if (dojo.lang.isArray(start)) {
17
		var diff = [];
19
		var diff = [];
18
		dojo.lang.forEach(this.start, function (s, i) {
20
		dojo.lang.forEach(this.start, function (s, i) {
19
			diff[i] = this.end[i] - s;
21
			diff[i] = this.end[i] - s;
20
		}, this);
22
		}, this);
21
		this.getValue = function (n) {
23
		this.getValue = function (n) {
22
			var res = [];
24
			var res = [];
23
			dojo.lang.forEach(this.start, function (s, i) {
25
			dojo.lang.forEach(this.start, function (s, i) {
24
				res[i] = (diff[i] * n) + s;
26
				res[i] = (diff[i] * n) + s;
25
			}, this);
27
			}, this);
26
			return res;
28
			return res;
27
		};
29
		};
28
	} else {
30
	} else {
29
		var diff = end - start;
31
		var diff = end - start;
30
		this.getValue = function (n) {
32
		this.getValue = function (n) {
31
			return (diff * n) + this.start;
33
			return (diff * n) + this.start;
32
		};
34
		};
33
	}
35
	}
34
};
36
};
35
if ((dojo.render.html.khtml) && (!dojo.render.html.safari)) {
37
if ((dojo.render.html.khtml) && (!dojo.render.html.safari)) {
36
	dojo.lfx.easeDefault = function (n) {
38
	dojo.lfx.easeDefault = function (n) {
37
		return (parseFloat("0.5") + ((Math.sin((n + parseFloat("1.5")) * Math.PI)) / 2));
39
		return (parseFloat("0.5") + ((Math.sin((n + parseFloat("1.5")) * Math.PI)) / 2));
38
	};
40
	};
39
} else {
41
} else {
40
	dojo.lfx.easeDefault = function (n) {
42
	dojo.lfx.easeDefault = function (n) {
41
		return (0.5 + ((Math.sin((n + 1.5) * Math.PI)) / 2));
43
		return (0.5 + ((Math.sin((n + 1.5) * Math.PI)) / 2));
42
	};
44
	};
43
}
45
}
44
dojo.lfx.easeIn = function (n) {
46
dojo.lfx.easeIn = function (n) {
45
	return Math.pow(n, 3);
47
	return Math.pow(n, 3);
46
};
48
};
47
dojo.lfx.easeOut = function (n) {
49
dojo.lfx.easeOut = function (n) {
48
	return (1 - Math.pow(1 - n, 3));
50
	return (1 - Math.pow(1 - n, 3));
49
};
51
};
50
dojo.lfx.easeInOut = function (n) {
52
dojo.lfx.easeInOut = function (n) {
51
	return ((3 * Math.pow(n, 2)) - (2 * Math.pow(n, 3)));
53
	return ((3 * Math.pow(n, 2)) - (2 * Math.pow(n, 3)));
52
};
54
};
53
dojo.lfx.IAnimation = function () {
55
dojo.lfx.IAnimation = function () {
54
};
56
};
55
dojo.lang.extend(dojo.lfx.IAnimation, {curve:null, duration:1000, easing:null, repeatCount:0, rate:10, handler:null, beforeBegin:null, onBegin:null, onAnimate:null, onEnd:null, onPlay:null, onPause:null, onStop:null, play:null, pause:null, stop:null, connect:function (evt, scope, newFunc) {
57
dojo.lang.extend(dojo.lfx.IAnimation, {curve:null, duration:1000, easing:null, repeatCount:0, rate:10, handler:null, beforeBegin:null, onBegin:null, onAnimate:null, onEnd:null, onPlay:null, onPause:null, onStop:null, play:null, pause:null, stop:null, connect:function (evt, scope, newFunc) {
56
	if (!newFunc) {
58
	if (!newFunc) {
57
		newFunc = scope;
59
		newFunc = scope;
58
		scope = this;
60
		scope = this;
59
	}
61
	}
60
	newFunc = dojo.lang.hitch(scope, newFunc);
62
	newFunc = dojo.lang.hitch(scope, newFunc);
61
	var oldFunc = this[evt] || function () {
63
	var oldFunc = this[evt] || function () {
62
	};
64
	};
63
	this[evt] = function () {
65
	this[evt] = function () {
64
		var ret = oldFunc.apply(this, arguments);
66
		var ret = oldFunc.apply(this, arguments);
65
		newFunc.apply(this, arguments);
67
		newFunc.apply(this, arguments);
66
		return ret;
68
		return ret;
67
	};
69
	};
68
	return this;
70
	return this;
69
}, fire:function (evt, args) {
71
}, fire:function (evt, args) {
70
	if (this[evt]) {
72
	if (this[evt]) {
71
		this[evt].apply(this, (args || []));
73
		this[evt].apply(this, (args || []));
72
	}
74
	}
73
	return this;
75
	return this;
74
}, repeat:function (count) {
76
}, repeat:function (count) {
75
	this.repeatCount = count;
77
	this.repeatCount = count;
76
	return this;
78
	return this;
77
}, _active:false, _paused:false});
79
}, _active:false, _paused:false});
78
dojo.lfx.Animation = function (handlers, duration, curve, easing, repeatCount, rate) {
80
dojo.lfx.Animation = function (handlers, duration, curve, easing, repeatCount, rate) {
79
	dojo.lfx.IAnimation.call(this);
81
	dojo.lfx.IAnimation.call(this);
80
	if (dojo.lang.isNumber(handlers) || (!handlers && duration.getValue)) {
82
	if (dojo.lang.isNumber(handlers) || (!handlers && duration.getValue)) {
81
		rate = repeatCount;
83
		rate = repeatCount;
82
		repeatCount = easing;
84
		repeatCount = easing;
83
		easing = curve;
85
		easing = curve;
84
		curve = duration;
86
		curve = duration;
85
		duration = handlers;
87
		duration = handlers;
86
		handlers = null;
88
		handlers = null;
87
	} else {
89
	} else {
88
		if (handlers.getValue || dojo.lang.isArray(handlers)) {
90
		if (handlers.getValue || dojo.lang.isArray(handlers)) {
89
			rate = easing;
91
			rate = easing;
90
			repeatCount = curve;
92
			repeatCount = curve;
91
			easing = duration;
93
			easing = duration;
92
			curve = handlers;
94
			curve = handlers;
93
			duration = null;
95
			duration = null;
94
			handlers = null;
96
			handlers = null;
95
		}
97
		}
96
	}
98
	}
97
	if (dojo.lang.isArray(curve)) {
99
	if (dojo.lang.isArray(curve)) {
98
		this.curve = new dojo.lfx.Line(curve[0], curve[1]);
100
		this.curve = new dojo.lfx.Line(curve[0], curve[1]);
99
	} else {
101
	} else {
100
		this.curve = curve;
102
		this.curve = curve;
101
	}
103
	}
102
	if (duration != null && duration > 0) {
104
	if (duration != null && duration > 0) {
103
		this.duration = duration;
105
		this.duration = duration;
104
	}
106
	}
105
	if (repeatCount) {
107
	if (repeatCount) {
106
		this.repeatCount = repeatCount;
108
		this.repeatCount = repeatCount;
107
	}
109
	}
108
	if (rate) {
110
	if (rate) {
109
		this.rate = rate;
111
		this.rate = rate;
110
	}
112
	}
111
	if (handlers) {
113
	if (handlers) {
112
		dojo.lang.forEach(["handler", "beforeBegin", "onBegin", "onEnd", "onPlay", "onStop", "onAnimate"], function (item) {
114
		dojo.lang.forEach(["handler", "beforeBegin", "onBegin", "onEnd", "onPlay", "onStop", "onAnimate"], function (item) {
113
			if (handlers[item]) {
115
			if (handlers[item]) {
114
				this.connect(item, handlers[item]);
116
				this.connect(item, handlers[item]);
115
			}
117
			}
116
		}, this);
118
		}, this);
117
	}
119
	}
118
	if (easing && dojo.lang.isFunction(easing)) {
120
	if (easing && dojo.lang.isFunction(easing)) {
119
		this.easing = easing;
121
		this.easing = easing;
120
	}
122
	}
121
};
123
};
122
dojo.inherits(dojo.lfx.Animation, dojo.lfx.IAnimation);
124
dojo.inherits(dojo.lfx.Animation, dojo.lfx.IAnimation);
123
dojo.lang.extend(dojo.lfx.Animation, {_startTime:null, _endTime:null, _timer:null, _percent:0, _startRepeatCount:0, play:function (delay, gotoStart) {
125
dojo.lang.extend(dojo.lfx.Animation, {_startTime:null, _endTime:null, _timer:null, _percent:0, _startRepeatCount:0, play:function (delay, gotoStart) {
124
	if (gotoStart) {
126
	if (gotoStart) {
125
		clearTimeout(this._timer);
127
		clearTimeout(this._timer);
126
		this._active = false;
128
		this._active = false;
127
		this._paused = false;
129
		this._paused = false;
128
		this._percent = 0;
130
		this._percent = 0;
129
	} else {
131
	} else {
130
		if (this._active && !this._paused) {
132
		if (this._active && !this._paused) {
131
			return this;
133
			return this;
132
		}
134
		}
133
	}
135
	}
134
	this.fire("handler", ["beforeBegin"]);
136
	this.fire("handler", ["beforeBegin"]);
135
	this.fire("beforeBegin");
137
	this.fire("beforeBegin");
136
	if (delay > 0) {
138
	if (delay > 0) {
137
		setTimeout(dojo.lang.hitch(this, function () {
139
		setTimeout(dojo.lang.hitch(this, function () {
138
			this.play(null, gotoStart);
140
			this.play(null, gotoStart);
139
		}), delay);
141
		}), delay);
140
		return this;
142
		return this;
141
	}
143
	}
142
	this._startTime = new Date().valueOf();
144
	this._startTime = new Date().valueOf();
143
	if (this._paused) {
145
	if (this._paused) {
144
		this._startTime -= (this.duration * this._percent / 100);
146
		this._startTime -= (this.duration * this._percent / 100);
145
	}
147
	}
146
	this._endTime = this._startTime + this.duration;
148
	this._endTime = this._startTime + this.duration;
147
	this._active = true;
149
	this._active = true;
148
	this._paused = false;
150
	this._paused = false;
149
	var step = this._percent / 100;
151
	var step = this._percent / 100;
150
	var value = this.curve.getValue(step);
152
	var value = this.curve.getValue(step);
151
	if (this._percent == 0) {
153
	if (this._percent == 0) {
152
		if (!this._startRepeatCount) {
154
		if (!this._startRepeatCount) {
153
			this._startRepeatCount = this.repeatCount;
155
			this._startRepeatCount = this.repeatCount;
154
		}
156
		}
155
		this.fire("handler", ["begin", value]);
157
		this.fire("handler", ["begin", value]);
156
		this.fire("onBegin", [value]);
158
		this.fire("onBegin", [value]);
157
	}
159
	}
158
	this.fire("handler", ["play", value]);
160
	this.fire("handler", ["play", value]);
159
	this.fire("onPlay", [value]);
161
	this.fire("onPlay", [value]);
160
	this._cycle();
162
	this._cycle();
161
	return this;
163
	return this;
162
}, pause:function () {
164
}, pause:function () {
163
	clearTimeout(this._timer);
165
	clearTimeout(this._timer);
164
	if (!this._active) {
166
	if (!this._active) {
165
		return this;
167
		return this;
166
	}
168
	}
167
	this._paused = true;
169
	this._paused = true;
168
	var value = this.curve.getValue(this._percent / 100);
170
	var value = this.curve.getValue(this._percent / 100);
169
	this.fire("handler", ["pause", value]);
171
	this.fire("handler", ["pause", value]);
170
	this.fire("onPause", [value]);
172
	this.fire("onPause", [value]);
171
	return this;
173
	return this;
172
}, gotoPercent:function (pct, andPlay) {
174
}, gotoPercent:function (pct, andPlay) {
173
	clearTimeout(this._timer);
175
	clearTimeout(this._timer);
174
	this._active = true;
176
	this._active = true;
175
	this._paused = true;
177
	this._paused = true;
176
	this._percent = pct;
178
	this._percent = pct;
177
	if (andPlay) {
179
	if (andPlay) {
178
		this.play();
180
		this.play();
179
	}
181
	}
180
	return this;
182
	return this;
181
}, stop:function (gotoEnd) {
183
}, stop:function (gotoEnd) {
182
	clearTimeout(this._timer);
184
	clearTimeout(this._timer);
183
	var step = this._percent / 100;
185
	var step = this._percent / 100;
184
	if (gotoEnd) {
186
	if (gotoEnd) {
185
		step = 1;
187
		step = 1;
186
	}
188
	}
187
	var value = this.curve.getValue(step);
189
	var value = this.curve.getValue(step);
188
	this.fire("handler", ["stop", value]);
190
	this.fire("handler", ["stop", value]);
189
	this.fire("onStop", [value]);
191
	this.fire("onStop", [value]);
190
	this._active = false;
192
	this._active = false;
191
	this._paused = false;
193
	this._paused = false;
192
	return this;
194
	return this;
193
}, status:function () {
195
}, status:function () {
194
	if (this._active) {
196
	if (this._active) {
195
		return this._paused ? "paused" : "playing";
197
		return this._paused ? "paused" : "playing";
196
	} else {
198
	} else {
197
		return "stopped";
199
		return "stopped";
198
	}
200
	}
199
	return this;
201
	return this;
200
}, _cycle:function () {
202
}, _cycle:function () {
201
	clearTimeout(this._timer);
203
	clearTimeout(this._timer);
202
	if (this._active) {
204
	if (this._active) {
203
		var curr = new Date().valueOf();
205
		var curr = new Date().valueOf();
204
		var step = (curr - this._startTime) / (this._endTime - this._startTime);
206
		var step = (curr - this._startTime) / (this._endTime - this._startTime);
205
		if (step >= 1) {
207
		if (step >= 1) {
206
			step = 1;
208
			step = 1;
207
			this._percent = 100;
209
			this._percent = 100;
208
		} else {
210
		} else {
209
			this._percent = step * 100;
211
			this._percent = step * 100;
210
		}
212
		}
211
		if ((this.easing) && (dojo.lang.isFunction(this.easing))) {
213
		if ((this.easing) && (dojo.lang.isFunction(this.easing))) {
212
			step = this.easing(step);
214
			step = this.easing(step);
213
		}
215
		}
214
		var value = this.curve.getValue(step);
216
		var value = this.curve.getValue(step);
215
		this.fire("handler", ["animate", value]);
217
		this.fire("handler", ["animate", value]);
216
		this.fire("onAnimate", [value]);
218
		this.fire("onAnimate", [value]);
217
		if (step < 1) {
219
		if (step < 1) {
218
			this._timer = setTimeout(dojo.lang.hitch(this, "_cycle"), this.rate);
220
			this._timer = setTimeout(dojo.lang.hitch(this, "_cycle"), this.rate);
219
		} else {
221
		} else {
220
			this._active = false;
222
			this._active = false;
221
			this.fire("handler", ["end"]);
223
			this.fire("handler", ["end"]);
222
			this.fire("onEnd");
224
			this.fire("onEnd");
223
			if (this.repeatCount > 0) {
225
			if (this.repeatCount > 0) {
224
				this.repeatCount--;
226
				this.repeatCount--;
225
				this.play(null, true);
227
				this.play(null, true);
226
			} else {
228
			} else {
227
				if (this.repeatCount == -1) {
229
				if (this.repeatCount == -1) {
228
					this.play(null, true);
230
					this.play(null, true);
229
				} else {
231
				} else {
230
					if (this._startRepeatCount) {
232
					if (this._startRepeatCount) {
231
						this.repeatCount = this._startRepeatCount;
233
						this.repeatCount = this._startRepeatCount;
232
						this._startRepeatCount = 0;
234
						this._startRepeatCount = 0;
233
					}
235
					}
234
				}
236
				}
235
			}
237
			}
236
		}
238
		}
237
	}
239
	}
238
	return this;
240
	return this;
239
}});
241
}});
240
dojo.lfx.Combine = function (animations) {
242
dojo.lfx.Combine = function (animations) {
241
	dojo.lfx.IAnimation.call(this);
243
	dojo.lfx.IAnimation.call(this);
242
	this._anims = [];
244
	this._anims = [];
243
	this._animsEnded = 0;
245
	this._animsEnded = 0;
244
	var anims = arguments;
246
	var anims = arguments;
245
	if (anims.length == 1 && (dojo.lang.isArray(anims[0]) || dojo.lang.isArrayLike(anims[0]))) {
247
	if (anims.length == 1 && (dojo.lang.isArray(anims[0]) || dojo.lang.isArrayLike(anims[0]))) {
246
		anims = anims[0];
248
		anims = anims[0];
247
	}
249
	}
248
	dojo.lang.forEach(anims, function (anim) {
250
	dojo.lang.forEach(anims, function (anim) {
249
		this._anims.push(anim);
251
		this._anims.push(anim);
250
		anim.connect("onEnd", dojo.lang.hitch(this, "_onAnimsEnded"));
252
		anim.connect("onEnd", dojo.lang.hitch(this, "_onAnimsEnded"));
251
	}, this);
253
	}, this);
252
};
254
};
253
dojo.inherits(dojo.lfx.Combine, dojo.lfx.IAnimation);
255
dojo.inherits(dojo.lfx.Combine, dojo.lfx.IAnimation);
254
dojo.lang.extend(dojo.lfx.Combine, {_animsEnded:0, play:function (delay, gotoStart) {
256
dojo.lang.extend(dojo.lfx.Combine, {_animsEnded:0, play:function (delay, gotoStart) {
255
	if (!this._anims.length) {
257
	if (!this._anims.length) {
256
		return this;
258
		return this;
257
	}
259
	}
258
	this.fire("beforeBegin");
260
	this.fire("beforeBegin");
259
	if (delay > 0) {
261
	if (delay > 0) {
260
		setTimeout(dojo.lang.hitch(this, function () {
262
		setTimeout(dojo.lang.hitch(this, function () {
261
			this.play(null, gotoStart);
263
			this.play(null, gotoStart);
262
		}), delay);
264
		}), delay);
263
		return this;
265
		return this;
264
	}
266
	}
265
	if (gotoStart || this._anims[0].percent == 0) {
267
	if (gotoStart || this._anims[0].percent == 0) {
266
		this.fire("onBegin");
268
		this.fire("onBegin");
267
	}
269
	}
268
	this.fire("onPlay");
270
	this.fire("onPlay");
269
	this._animsCall("play", null, gotoStart);
271
	this._animsCall("play", null, gotoStart);
270
	return this;
272
	return this;
271
}, pause:function () {
273
}, pause:function () {
272
	this.fire("onPause");
274
	this.fire("onPause");
273
	this._animsCall("pause");
275
	this._animsCall("pause");
274
	return this;
276
	return this;
275
}, stop:function (gotoEnd) {
277
}, stop:function (gotoEnd) {
276
	this.fire("onStop");
278
	this.fire("onStop");
277
	this._animsCall("stop", gotoEnd);
279
	this._animsCall("stop", gotoEnd);
278
	return this;
280
	return this;
279
}, _onAnimsEnded:function () {
281
}, _onAnimsEnded:function () {
280
	this._animsEnded++;
282
	this._animsEnded++;
281
	if (this._animsEnded >= this._anims.length) {
283
	if (this._animsEnded >= this._anims.length) {
282
		this.fire("onEnd");
284
		this.fire("onEnd");
283
	}
285
	}
284
	return this;
286
	return this;
285
}, _animsCall:function (funcName) {
287
}, _animsCall:function (funcName) {
286
	var args = [];
288
	var args = [];
287
	if (arguments.length > 1) {
289
	if (arguments.length > 1) {
288
		for (var i = 1; i < arguments.length; i++) {
290
		for (var i = 1; i < arguments.length; i++) {
289
			args.push(arguments[i]);
291
			args.push(arguments[i]);
290
		}
292
		}
291
	}
293
	}
292
	var _this = this;
294
	var _this = this;
293
	dojo.lang.forEach(this._anims, function (anim) {
295
	dojo.lang.forEach(this._anims, function (anim) {
294
		anim[funcName](args);
296
		anim[funcName](args);
295
	}, _this);
297
	}, _this);
296
	return this;
298
	return this;
297
}});
299
}});
298
dojo.lfx.Chain = function (animations) {
300
dojo.lfx.Chain = function (animations) {
299
	dojo.lfx.IAnimation.call(this);
301
	dojo.lfx.IAnimation.call(this);
300
	this._anims = [];
302
	this._anims = [];
301
	this._currAnim = -1;
303
	this._currAnim = -1;
302
	var anims = arguments;
304
	var anims = arguments;
303
	if (anims.length == 1 && (dojo.lang.isArray(anims[0]) || dojo.lang.isArrayLike(anims[0]))) {
305
	if (anims.length == 1 && (dojo.lang.isArray(anims[0]) || dojo.lang.isArrayLike(anims[0]))) {
304
		anims = anims[0];
306
		anims = anims[0];
305
	}
307
	}
306
	var _this = this;
308
	var _this = this;
307
	dojo.lang.forEach(anims, function (anim, i, anims_arr) {
309
	dojo.lang.forEach(anims, function (anim, i, anims_arr) {
308
		this._anims.push(anim);
310
		this._anims.push(anim);
309
		if (i < anims_arr.length - 1) {
311
		if (i < anims_arr.length - 1) {
310
			anim.connect("onEnd", dojo.lang.hitch(this, "_playNext"));
312
			anim.connect("onEnd", dojo.lang.hitch(this, "_playNext"));
311
		} else {
313
		} else {
312
			anim.connect("onEnd", dojo.lang.hitch(this, function () {
314
			anim.connect("onEnd", dojo.lang.hitch(this, function () {
313
				this.fire("onEnd");
315
				this.fire("onEnd");
314
			}));
316
			}));
315
		}
317
		}
316
	}, this);
318
	}, this);
317
};
319
};
318
dojo.inherits(dojo.lfx.Chain, dojo.lfx.IAnimation);
320
dojo.inherits(dojo.lfx.Chain, dojo.lfx.IAnimation);
319
dojo.lang.extend(dojo.lfx.Chain, {_currAnim:-1, play:function (delay, gotoStart) {
321
dojo.lang.extend(dojo.lfx.Chain, {_currAnim:-1, play:function (delay, gotoStart) {
320
	if (!this._anims.length) {
322
	if (!this._anims.length) {
321
		return this;
323
		return this;
322
	}
324
	}
323
	if (gotoStart || !this._anims[this._currAnim]) {
325
	if (gotoStart || !this._anims[this._currAnim]) {
324
		this._currAnim = 0;
326
		this._currAnim = 0;
325
	}
327
	}
326
	var currentAnimation = this._anims[this._currAnim];
328
	var currentAnimation = this._anims[this._currAnim];
327
	this.fire("beforeBegin");
329
	this.fire("beforeBegin");
328
	if (delay > 0) {
330
	if (delay > 0) {
329
		setTimeout(dojo.lang.hitch(this, function () {
331
		setTimeout(dojo.lang.hitch(this, function () {
330
			this.play(null, gotoStart);
332
			this.play(null, gotoStart);
331
		}), delay);
333
		}), delay);
332
		return this;
334
		return this;
333
	}
335
	}
334
	if (currentAnimation) {
336
	if (currentAnimation) {
335
		if (this._currAnim == 0) {
337
		if (this._currAnim == 0) {
336
			this.fire("handler", ["begin", this._currAnim]);
338
			this.fire("handler", ["begin", this._currAnim]);
337
			this.fire("onBegin", [this._currAnim]);
339
			this.fire("onBegin", [this._currAnim]);
338
		}
340
		}
339
		this.fire("onPlay", [this._currAnim]);
341
		this.fire("onPlay", [this._currAnim]);
340
		currentAnimation.play(null, gotoStart);
342
		currentAnimation.play(null, gotoStart);
341
	}
343
	}
342
	return this;
344
	return this;
343
}, pause:function () {
345
}, pause:function () {
344
	if (this._anims[this._currAnim]) {
346
	if (this._anims[this._currAnim]) {
345
		this._anims[this._currAnim].pause();
347
		this._anims[this._currAnim].pause();
346
		this.fire("onPause", [this._currAnim]);
348
		this.fire("onPause", [this._currAnim]);
347
	}
349
	}
348
	return this;
350
	return this;
349
}, playPause:function () {
351
}, playPause:function () {
350
	if (this._anims.length == 0) {
352
	if (this._anims.length == 0) {
351
		return this;
353
		return this;
352
	}
354
	}
353
	if (this._currAnim == -1) {
355
	if (this._currAnim == -1) {
354
		this._currAnim = 0;
356
		this._currAnim = 0;
355
	}
357
	}
356
	var currAnim = this._anims[this._currAnim];
358
	var currAnim = this._anims[this._currAnim];
357
	if (currAnim) {
359
	if (currAnim) {
358
		if (!currAnim._active || currAnim._paused) {
360
		if (!currAnim._active || currAnim._paused) {
359
			this.play();
361
			this.play();
360
		} else {
362
		} else {
361
			this.pause();
363
			this.pause();
362
		}
364
		}
363
	}
365
	}
364
	return this;
366
	return this;
365
}, stop:function () {
367
}, stop:function () {
366
	var currAnim = this._anims[this._currAnim];
368
	var currAnim = this._anims[this._currAnim];
367
	if (currAnim) {
369
	if (currAnim) {
368
		currAnim.stop();
370
		currAnim.stop();
369
		this.fire("onStop", [this._currAnim]);
371
		this.fire("onStop", [this._currAnim]);
370
	}
372
	}
371
	return currAnim;
373
	return currAnim;
372
}, _playNext:function () {
374
}, _playNext:function () {
373
	if (this._currAnim == -1 || this._anims.length == 0) {
375
	if (this._currAnim == -1 || this._anims.length == 0) {
374
		return this;
376
		return this;
375
	}
377
	}
376
	this._currAnim++;
378
	this._currAnim++;
377
	if (this._anims[this._currAnim]) {
379
	if (this._anims[this._currAnim]) {
378
		this._anims[this._currAnim].play(null, true);
380
		this._anims[this._currAnim].play(null, true);
379
	}
381
	}
380
	return this;
382
	return this;
381
}});
383
}});
382
dojo.lfx.combine = function (animations) {
384
dojo.lfx.combine = function (animations) {
383
	var anims = arguments;
385
	var anims = arguments;
384
	if (dojo.lang.isArray(arguments[0])) {
386
	if (dojo.lang.isArray(arguments[0])) {
385
		anims = arguments[0];
387
		anims = arguments[0];
386
	}
388
	}
387
	if (anims.length == 1) {
389
	if (anims.length == 1) {
388
		return anims[0];
390
		return anims[0];
389
	}
391
	}
390
	return new dojo.lfx.Combine(anims);
392
	return new dojo.lfx.Combine(anims);
391
};
393
};
392
dojo.lfx.chain = function (animations) {
394
dojo.lfx.chain = function (animations) {
393
	var anims = arguments;
395
	var anims = arguments;
394
	if (dojo.lang.isArray(arguments[0])) {
396
	if (dojo.lang.isArray(arguments[0])) {
395
		anims = arguments[0];
397
		anims = arguments[0];
396
	}
398
	}
397
	if (anims.length == 1) {
399
	if (anims.length == 1) {
398
		return anims[0];
400
		return anims[0];
399
	}
401
	}
400
	return new dojo.lfx.Chain(anims);
402
	return new dojo.lfx.Chain(anims);
401
};
403
};
402
 
404