This project is archived and is in readonly mode.

#377 ✓invalid
Antti Kumpulainen

Fx needs an event that fires on each step

Reported by Antti Kumpulainen | September 12th, 2008 @ 07:36 PM | in 2.0 (closed)

I happened to come across a situation in which I want to update something else after each step had happened in tween. I didn't know how else I could to that other than modifying the step function. Here I just added one line that fires the step event and then you can just add onStep to the options of the effect.


Fx.implement({
	step: function(){
		var time = $time();
		if (time < this.time + this.options.duration){
			var delta = this.options.transition((time - this.time) / this.options.duration);
			this.set(this.compute(this.from, this.to, delta));
			this.fireEvent('step', this.subject);
		} else {
			this.set(this.compute(this.from, this.to, 1));
			this.complete();
		}
	}
});

Comments and changes to this ticket

  • Jan Kassens

    Jan Kassens September 12th, 2008 @ 08:17 PM

    • State changed from “new” to “invalid”
    • Tag changed from enhancement, events, fx, patch to enhancement, events, fx, patch, wontfix

    as you showed here, its easy to implement this addition on your own (i'd suggest extending Fx or Fx.Tween instead). The usage would be rare and step needs to be as fast as possible... firing an event is fast, but still too expansive for the rare usage of an 'step' event.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Pages