SkidX / tweene

JavaScript Animation Proxy
http://tweene.com
Artistic License 2.0
353 stars 29 forks source link

Velocity progress event parameters undefined #18

Closed ScottDodsonDev closed 8 years ago

ScottDodsonDev commented 8 years ago

The docs state, "The event implementation relies on library's native progress event if available." The progress event fires but the values for "complete", "remaining", "start", and "tweenValue" are undefined. Is this a bug or should I get the values a different way?

SkidX commented 8 years ago

Hi, sorry about that, english is not my motherlanguage and probably I've not expressed the concept in the proper way in the docs. I was talking about, let's say, "internal implementation", it means that internally I use that event so the frequency is the same and it will fire almost in the same instants using Tweene or the native library by itself. About those values, they are not available in any way. However there are two methods - not documented yet but they are already in the code - that you could use to get the current elapsed time (in seconds or milliseconds, based on the default time unit you have choosen) and current progress percent (a value between 0 and 1). Inside the progress event handler, you can refer them with this.time() and this.progress(), unless you have provided a different scope for the event handler callback. You can easily obtain the "remaining" value doing something like this.duration() - this.time().

As a general rule, every event handler in Tweene has no parameters by default, but you can pass your own values to them and change the scope object too.

ScottDodsonDev commented 8 years ago

Thanks! I'm having a fun time with Tweene. I'm really looking forward to a seek feature.

SkidX commented 8 years ago

I'm already working on the seek feature. I'm very busy at work too, so it will take a little bit more, but it is already under development. Stay tuned :)