Opened 7 years ago

Last modified 3 years ago

#14636 assigned defect

Chained animation not so chained

Reported by: gaxweb Owned by: dylan
Priority: high Milestone: 1.15
Component: fx Version: 1.7.1
Keywords: fx, animation, chaining Cc:
Blocked By: Blocking:

Description

A chained animation works fine on the first run. But after it has finished once, calling .start() on it again, the chained animation is not working right. It appears to only ever play the last entry in the array (found that out after switching them around) anymore.

Demo by Karl Tiedt here: http://jsfiddle.net/W7sjf/ My code example: http://pastebin.com/PRWviFhf

Change History (6)

comment:1 Changed 7 years ago by Karl Tiedt

Looking at the chain object... there is no handling for gotoStart and resetting _current to _animations[0]

		play: function(/*int?*/ delay, /*Boolean?*/ gotoStart){
			if(!this._current){ this._current = this._animations[this._index = 0]; }
			if(!gotoStart && this._current.status() == "playing"){ return this; }
			var beforeBegin = connect.connect(this._current, "beforeBegin", this, function(){
					this._fire("beforeBegin");
				}),
				onBegin = connect.connect(this._current, "onBegin", this, function(arg){
					this._fire("onBegin", arguments);
				}),
				onPlay = connect.connect(this._current, "onPlay", this, function(arg){
					this._fire("onPlay", arguments);
					connect.disconnect(beforeBegin);
					connect.disconnect(onBegin);
					connect.disconnect(onPlay);
				});
			if(this._onAnimateCtx){
				connect.disconnect(this._onAnimateCtx);
			}
			this._onAnimateCtx = connect.connect(this._current, "onAnimate", this, "_onAnimate");
			if(this._onEndCtx){
				connect.disconnect(this._onEndCtx);
			}
			this._onEndCtx = connect.connect(this._current, "onEnd", this, "_onEnd");
			this._current.play.apply(this._current, arguments);
			return this;
		},

comment:2 Changed 7 years ago by Karl Tiedt

Believe this is enough to illustrate that is infact the problem:

http://jsfiddle.net/W7sjf/1/

updating _onEnd handler to reset _current and _index appears to suffice

comment:3 in reply to:  2 Changed 7 years ago by gaxweb

Replying to ktiedt:

I've applied your concept to my code, and it fixed that problem. It became evident though, that dojo.fx.combine has the same problem, since my ani_dissemble animation didn't rewind itself either after running it for the first time. Adding the manual resets fixed it there as well.

comment:4 Changed 5 years ago by dylan

Milestone: tbd1.11
Owner: changed from Bryan Forbes to dylan
Status: newassigned

comment:5 Changed 4 years ago by dylan

Milestone: 1.111.12

comment:6 Changed 3 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.