Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Progress callback only called in the first animation loop #292

Closed
raphaelrauwolf opened this issue Sep 10, 2014 · 9 comments
Closed

Progress callback only called in the first animation loop #292

raphaelrauwolf opened this issue Sep 10, 2014 · 9 comments
Labels

Comments

@raphaelrauwolf
Copy link

When you loop any velocity animation, the progress callback is called only in the first loop and after that it is ignored.

$("div").velocity(
  { scale: 1.5 },
  {
    duration: 5000,
    loop: true,
    progress: function(elements, percentComplete, timeRemaining, timeStart) {
      console.log('percent : ', percentComplete);
      // Stops after the first loop and never gets called again
    }
});
@raphaelrauwolf raphaelrauwolf changed the title progress callback only called in the first animation loop Progress callback only called in the first animation loop Sep 10, 2014
@ydaniv
Copy link
Contributor

ydaniv commented Sep 10, 2014

@raphaelrauwolf thanks! That's correct.
By definition, the setting loop: true does alter behavior of callbacks.

I'm not sure, though, if the progress callback will mean anything in this case.
Can you provide a real-life scenario for changing current behavior to reset progress on every iteration?

@raphaelrauwolf
Copy link
Author

In the documentation, you only state that begin and complete callbacks alter their behavior.

That the begin callback only is called in the beginning of the first loop and the complete callback is called on the end of the last loop seems totally fine for me, but that the progress callback is only called in the first loop seems a bit off, since the animation is still 'in progress'.

The real-life scenario would be : http://jsfiddle.net/5adbtywv/.

@ydaniv
Copy link
Contributor

ydaniv commented Sep 10, 2014

I agree it is not the expected behavior, question is whether we support this behavior or ignore it.

That's a cool use for it (:
What you're doing here should actually be done using regular tweening, only IE specific CSS props are not supported.

@julianshapiro IINM it's just adding another line here copying the progress callback.

@julianshapiro
Copy link
Owner

@raphaelrauwolf: I consider this a bug. Will fix, thanks.
@ydaniv: Thanks! That's actually not the trouble area. Not sure where is. Upon first glance I'm not sure why this is happening, but I'll dig in later this week.

Stay tuned!

@julianshapiro
Copy link
Owner

Oops. @ydaniv: That was the right area. Lol.

@julianshapiro
Copy link
Owner

Done. Coming up in the next release.

@julianshapiro
Copy link
Owner

Please check, make sure it works, and get back to me. Thanks!

@raphaelrauwolf
Copy link
Author

Works fine! Thank you! http://jsfiddle.net/5adbtywv/2/

@TiagoSousa26
Copy link

I think the problem of ingoring the loop still there because I am using the progress and complete and before I do loop:4 and it ignore the loop but if I do loop: true it ingore the loop and ingore the complete.

Rycochet pushed a commit that referenced this issue Aug 3, 2020
Internal “Sequences” have been renamed to “Redirects”. You shouldn’t
have been using them (they were deprecated), so this is not being
considered backwards-incompatible.

`Velocity.mock` now accepts a multiplier value in addition to `true`.
Use it for slowing down/speeding up animations globally when testing.
`true` mock has also been fixed to also reduce `delay`s to 1ms.

You can now animate `filter: blur(value);` for -webkit- browsers. Note
that animating this property will strip out all other `filter`
components. Note that, at the time of this update, Chrome incorrectly
returns blur values that were originally set with the `px` unit.

`color` RGB defaults to black instead of white, which is closer to
text’s typical color value.

`opts.progress` now gets repeatedly fired during looped calls. Closes
#292.

Fix jQuery-free `position: absolute` bug with left/top properties.
Closes #285.

Allow passing undefined as a second arg into Velocity. Closes #275.

Performance improvement: Individual property tweens don’t update the
DOM if there’s no change in value between loop ticks.

Fixes bug where `loop`ing on iOS devices (due to mobileHA) would cause
flickering. Closes #299.

Fixes bug where you couldn’t force-feed one hex value to another.

Can now set `visibility: “”`, just like you can with display.

Fixed bug where using `backwards: true:` with the UI pack mutated the
source array.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants